Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(ci): keep Windows ACL observation in SID form (#5941)

gensokyo-devc538a843cb49
diff --git a/docs/testing.md b/docs/testing.md
index 43ba47cde..e19db750b 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -679,6 +679,14 @@ miss. Native
artifacts, dependency installs, package archives, and runtime verification remain
host-local. Keep platform-dependent outputs out of this shared cache.
+The Windows native verifier's private-runtime ACL observer reads SID rules once
+for both trustee validation and counting. It deliberately rejects the convenience
+`Access` property, which resolves account names. Its `private-runtime-acl` stderr
+markers report completed phases and elapsed time; inspect these on a timeout
+before attributing it to startup, ACL reads, or identity lookup. The original
+15-second deadline and all ownership, DACL, and readonly assertions remain in
+force. A passing retry alone does not explain a previous timeout.
+
Record cold and warm preparation separately from fresh test execution when
benchmarking the optional `npm run check:pr` gate. Compare multiple runs on the
same host, including subprocess and queue costs; a cached pass is not a test
diff --git a/scripts/verify-windows-native.mjs b/scripts/verify-windows-native.mjs
index 70821c0a9..407763988 100644
--- a/scripts/verify-windows-native.mjs
+++ b/scripts/verify-windows-native.mjs
@@ -369,7 +369,38 @@ process.stdout.write(JSON.stringify({executable:basename(process.execPath),abiVe
"-NoProfile",
"-NonInteractive",
"-Command",
- "$ErrorActionPreference='Stop'; $p=$env:REA_TEST_PRIVATE_RUNTIME_PATH; $a=Get-Acl -LiteralPath $p; $u=[Security.Principal.WindowsIdentity]::GetCurrent().User; [IO.File]::SetAttributes($p,[IO.FileAttributes]([int][IO.File]::GetAttributes($p) -bor 1)); @{protected=$a.AreAccessRulesProtected; ownerMatchesUser=($a.GetOwner([Security.Principal.SecurityIdentifier]).Value -eq $u.Value); trusteesOnlyUserAndSystem=(@($a.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier]) | Where-Object {$_.IdentityReference.Value -ne $u.Value -and $_.IdentityReference.Value -ne 'S-1-5-18'}).Count -eq 0); count=@($a.Access).Count; rootReadonly=(([int][IO.File]::GetAttributes($p) -band 1) -ne 0)} | ConvertTo-Json -Compress",
+ String.raw`
+ $ErrorActionPreference = 'Stop'
+ $clock = [Diagnostics.Stopwatch]::StartNew()
+ function Trace-AclPhase([string]$phase) {
+ [Console]::Error.WriteLine('private-runtime-acl: ' + $phase + ' ' + $clock.ElapsedMilliseconds + 'ms')
+ }
+ Trace-AclPhase 'started'
+ $p = $env:REA_TEST_PRIVATE_RUNTIME_PATH
+ $a = Get-Acl -LiteralPath $p
+ Trace-AclPhase 'acl-read'
+ $u = [Security.Principal.WindowsIdentity]::GetCurrent().User
+ $owner = $a.GetOwner([Security.Principal.SecurityIdentifier])
+ Trace-AclPhase 'owner-sid-read'
+ # Guard the independent observer against accidental account-name resolution.
+ # Access is a PowerShell convenience property that requests NTAccount rules.
+ Update-TypeData -TypeName ($a.GetType().FullName) -MemberType ScriptProperty -MemberName Access -Value { throw 'ACL observation must use SID rules' } -Force
+ if ($a.PSObject.Properties['Access'].MemberType -ne [Management.Automation.PSMemberTypes]::ScriptProperty) {
+ throw 'ACL observation Access guard was not installed'
+ }
+ $rules = @($a.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier]))
+ Trace-AclPhase 'rule-sids-read'
+ [IO.File]::SetAttributes($p, [IO.FileAttributes]([int][IO.File]::GetAttributes($p) -bor 1))
+ Trace-AclPhase 'readonly-set'
+ @{
+ protected = $a.AreAccessRulesProtected
+ ownerMatchesUser = ($owner.Value -eq $u.Value)
+ trusteesOnlyUserAndSystem = (@($rules | Where-Object { $_.IdentityReference.Value -ne $u.Value -and $_.IdentityReference.Value -ne 'S-1-5-18' }).Count -eq 0)
+ count = $rules.Count
+ rootReadonly = (([int][IO.File]::GetAttributes($p) -band 1) -ne 0)
+ } | ConvertTo-Json -Compress
+ Trace-AclPhase 'complete'
+ `,
],
{
encoding: "utf8",