Skip to content

fix(windows): report the ACE count a private DACL check observed - #14450

Merged
vincentkoc merged 1 commit into
morluto:mainfrom
liziye627-design:fix/5237-private-dacl-ace-count
Nov 30, 2026
Merged

vincentkoc merged 1 commit into
morluto:mainfrom
liziye627-design:fix/5237-private-dacl-ace-count

Conversation

@liziye627-design

@liziye627-design liziye627-design commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

��## Summary

When verifyPrivate in native/windows/src/filesystem.cc rejects a private directory or file because its DACL trustee set does not match the expected two-ACE (current user, SYSTEM) contract, the thrown failure reported only the static constraint string without the observed ACE count, protection flag, or whether the process token user already equals SYSTEM.

This adds structured readback details (ace_count, protected, token_user_equals_system) to the three trustee-set refusals in verifyPrivate to diagnose #5237 without relaxing any Windows ACL security check. Rebased over #14769 (62a4bee42), which resolved the exclusive else if branch when two ACEs belong to SYSTEM (observeAce(isUser, isSystem) preserves that independent two-flag behavior); this PR covers the remaining structured readback on ace_count != 2 (including ace_count=1 or ace_count=3+), unrelated-principal, and missing-trustee refusals. Supersedes #10319 on a clean single-commit branch over current main (and does not include the closed #9182 experiment from #10318). Does not close #5237 because the root cause on the reporter's Windows host still needs the diagnostic output.

Problem and expected behavior

In #5237, Private DACL contains unexpected trustees (ERROR_ACCESS_DENIED) was raised immediately after REA created its own private directory, without revealing whether Windows read back ace_count=1 (for example when the token user is SYSTEM or an antivirus/filter injected an extra ACE), ace_count=3+, or an unexpected protection bit.

Expected behavior: verifyPrivate enforces the exact same two-trustee protected DACL invariant and ERROR_ACCESS_DENIED error code, and appends ; ace_count=<N|absent> protected=<0|1> token_user_equals_system=<0|1> to the three trustee-check failure messages (Private DACL contains unexpected trustees, Private DACL permits an unrelated principal, and Private DACL must allow only current user and SYSTEM). No SIDs, usernames, or paths beyond the existing failure path are exposed.

Change and scope

Extracts PrivateDaclTrusteeVerifier and formatPrivateDaclTrusteeReadback in native/windows/src/private_dacl.hpp and uses them for the three trustee-set refusals in verifyPrivate (native/windows/src/filesystem.cc). Ownership, DACL presence/protection, ACE type/flags/mask checks, and ERROR_ACCESS_DENIED semantics are unchanged.

Follow the contribution scope.
Not applicable. Diagnostic error detail inside existing Windows private-directory verification; no authority or security boundary relaxation.

Contract and boundary impact

  • Semantic owner and earliest changed stage: PrivateDaclTrusteeVerifier (native/windows/src/private_dacl.hpp) consumed by verifyPrivate (native/windows/src/filesystem.cc). Downstream native addon error propagation is unchanged.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none (refusal error detail string only when a private Windows DACL fails trustee validation).
  • Provider, bridge, target-format, or platform compatibility: Windows native filesystem control only; POSIX platforms unaffected.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): private-object ACL enforcement remains fail-closed.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: Windows native C++ source change verified by CI Native package baseline and Windows capability and package lane.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • native/windows/src/private_dacl_test.cc and src/windows/WindowsPrivateDacl.test.ts compile and execute C++17 unit tests covering all three trustee refusal paths (unexpected trustees including ace_count=1, ace_count=3, and ace_count=absent; unrelated principal; and must allow only current user and SYSTEM when two ACEs match the same principal or token_user_equals_system=1), asserting both the exact diagnostic suffix and ERROR_ACCESS_DENIED (win32Code == 5).
    • scripts/verify-windows-native.mjs exercises real NTFS protected-directory refusals through cutter_bridge_verify_directory for an unexpected three-trustee DACL and an unrelated-principal two-ACE DACL, asserting EACCES, win32Code === 5, and exact constraint readback strings on the Windows CI runner.
  • Base reproduction or other evidence: source inspection of native/windows/src/filesystem.cc for [Windows native] Private DACL contains unexpected trustees (Win32 5) blocks Android inspection before JADX #5237 (require(acl->AceCount == 2, "Private DACL contains unexpected trustees", path, ERROR_ACCESS_DENIED) discarded acl->AceCount, control, and EqualSid(expected.userSid(), expected.system.data())).
  • User-visible CLI/MCP output (if applicable): on trustee mismatch, the native failure detail now reports e.g. Private DACL contains unexpected trustees; ace_count=3 protected=1 token_user_equals_system=0.
  • Remaining proof gaps: local Windows checkout does not have Linux MinGW-w64 to cross-compile rea-windows-x64.node locally (native/windows/README.md#build); full native addon cross-compilation and scripts/verify-windows-native.mjs run in GitHub Actions (Native package baseline + Windows capability and package lane).

Boundary and lifecycle regressions: not applicable; verifyPrivate resource handles (LocalFree via descriptor RAII) and failure exit paths are unchanged.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npx vitest run src/windows/WindowsPrivateDacl.test.ts � passed (g++ -std=c++17 -Wall -Wextra -Werror C++17 refusal assertions).
  • npm run typecheck, npx oxlint -c .oxlintrc.json --quiet, npx oxfmt --check, npm run verify:architecture-guards, and npm run verify:module-boundaries � passed locally.
  • GitHub CI Native package baseline (Linux MinGW cross-build) and Windows capability and package lane (scripts/verify-windows-native.mjs) � verified in CI.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Error code (ERROR_ACCESS_DENIED) and prefix (Private DACL ...) are preserved.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows native addon compilation and capability verification run in GitHub Actions Windows/Linux lanes.
  • Package or release metadata impact: included in packaged rea-windows-x64.node on next native build/release.
  • Security, privacy, process, or containment review: fail-closed DACL validation is unchanged; readback reports only integer ACE count and boolean protected / token_user_equals_system flags without leaking SID strings or environment data.

Author readiness

Human owner: @liziye627-design

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Author checklist (completed by the PR author before requesting review)

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
  • I ran every test, build, or measurement needed to validate this change, reported a browser, GPU, or environment gap only when that runtime or hardware is unavailable, and reported the checks I ran and their results without presenting inferred correctness or speedups as measured.
  • Comments explain constraints or non-obvious decisions; task history and conversations stay out of code and docs.
  • Documentation is concise and factual, without punchy slogans or promotional language.
  • This change fixes the root cause and follows the engineering rules in AGENTS.md.
  • Formatted input is interpreted once at the owning boundary, and consumers use the owner's parsed facts. See Interpret boundary facts once.
  • Combined failures preserve partial observations, remaining resources, and cleanup facts. See Own the lifecycle.
  • A hardcoded limit is an REA_ runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-25T08:32:32.910518Z
We couldn’t complete this review. Comment @codex review to try again.
95e160b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the remaining test-coverage finding is non-blocking.

Findings

  1. P2 New diagnostics lack tests ▶
Fix with agent prompt
### Issue 1
native/windows/src/filesystem.cc:238-249
The new diagnostic text has no regression coverage. Existing success checks cannot show that the three trustee refusals include the observed values. Add refusal tests for an unexpected ACE count, an unrelated principal, and a missing expected trustee. Assert the suffix and unchanged `ERROR_ACCESS_DENIED` result so future edits cannot silently remove the information this PR adds.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds the observed ACE count, DACL protection flag, and whether the token user equals SYSTEM to three Windows trustee-refusal messages.

  • Windows private-object errors now show the ACL facts behind trustee refusals.

Reviews (2) · Last reviewed commit: "fix(windows): report the ACE count a pri..." · Reviewed by Greptile

Comment thread native/windows/src/filesystem.cc Resolved
@liziye627-design
liziye627-design force-pushed the fix/5237-private-dacl-ace-count branch from 95e160b to 2748e77 Compare November 25, 2026 08:58
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 26, 2026
@liziye627-design
liziye627-design force-pushed the fix/5237-private-dacl-ace-count branch 4 times, most recently from ec61e2e to 701c5fb Compare November 27, 2026 17:52
@vincentkoc
vincentkoc merged commit 0985a6b into morluto:main Nov 30, 2026
54 of 68 checks passed
@vincentkoc

Copy link
Copy Markdown
Collaborator

thanks! merged after a clean review, passing C++ regression, and green Windows CI.

vincentkoc added a commit to xu91102/rea that referenced this pull request Nov 30, 2026
* commit '4ccc685dd5ed028bc625fdd8760539ce5a492d8d': (228 commits)
  test(asar): verify cleanup on the original file handle (morluto#15155)
  fix(ubi): bound smaller-grid probe memoization (morluto#15168)
  fix(artifacts): distinguish content from containment changes (morluto#15165)
  fix(bflt): retain complete text when data is truncated (morluto#15160)
  refactor(domain): reuse graph projection and validation helpers (morluto#15173)
  fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801)
  test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172)
  test(beam): reuse the CLI Evidence reader (morluto#15171)
  test(oci): share descriptor budget refusal assertions (morluto#15159)
  refactor(audit): share byte framing for offline audit logs (morluto#15162)
  refactor(evidence): reuse observed file reports for binary metadata (morluto#15161)
  fix(doctor): omit package-runner cache shims from installations (morluto#15059)
  refactor(packages): share package inspection budget contracts (morluto#15158)
  refactor(desktop): share completed command answer recovery (morluto#15156)
  refactor(views): share page byte reservations (morluto#15152)
  refactor(artifacts): share GPU and media asset layout rules (morluto#15150)
  fix(setup): name the detected host when Hopper setup does not apply (morluto#14449)
  fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020)
  fix(windows): report the ACE count a private DACL check observed (morluto#14450)
  fix(artifacts): read Ogg Opus channel mapping tables (morluto#14975)
  ...
vincentkoc added a commit to liziye627-design/rea that referenced this pull request Nov 30, 2026
* commit 'e18ed55bac14191010efe91ba61489cab1d2ba55': (137 commits)
  fix(artifacts): report macOS package bundle release versions (morluto#14860)
  test(asar): verify cleanup on the original file handle (morluto#15155)
  fix(ubi): bound smaller-grid probe memoization (morluto#15168)
  fix(artifacts): distinguish content from containment changes (morluto#15165)
  fix(bflt): retain complete text when data is truncated (morluto#15160)
  refactor(domain): reuse graph projection and validation helpers (morluto#15173)
  fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801)
  test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172)
  test(beam): reuse the CLI Evidence reader (morluto#15171)
  test(oci): share descriptor budget refusal assertions (morluto#15159)
  refactor(audit): share byte framing for offline audit logs (morluto#15162)
  refactor(evidence): reuse observed file reports for binary metadata (morluto#15161)
  fix(doctor): omit package-runner cache shims from installations (morluto#15059)
  refactor(packages): share package inspection budget contracts (morluto#15158)
  refactor(desktop): share completed command answer recovery (morluto#15156)
  refactor(views): share page byte reservations (morluto#15152)
  refactor(artifacts): share GPU and media asset layout rules (morluto#15150)
  fix(setup): name the detected host when Hopper setup does not apply (morluto#14449)
  fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020)
  fix(windows): report the ACE count a private DACL check observed (morluto#14450)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

3 participants