fix: apply Windows private ACLs to scan output directories - #202
Conversation
Mirror credential-home ACL hardening for scan output prepare and resolve paths, including multiscan campaign roots, so shared Windows directories cannot inherit Allow access for other local principals. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR closes a security gap on Windows by ensuring scan output directories are protected with current-user-only ACLs (mirroring existing credential-home hardening), and by enforcing the same privacy gate across contract validation and bulk/multiscan flows.
Changes:
- Add
requirePrivateScanOutputand refactor Windows ACL enforcement into a sharedsecureWindowsPrivateDirectoryhelper. - Apply Windows scan-output ACL hardening during output preparation and during contract scan-root validation checks.
- Extend privacy enforcement to multiscan and bulk-scan output roots; add unit/integration test coverage (including a Windows-only ACL verification test).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/typescript/src/runtime.ts | Introduces requirePrivateScanOutput and shared Windows private-ACL helper; wires scan-output validation to enforce privacy on Windows and POSIX. |
| sdk/typescript/src/contract.ts | Re-validates scan roots using requirePrivateScanOutput to ensure Windows scan directories are ACL-hardened during contract load/verification. |
| sdk/typescript/src/multiscan.ts | Ensures multiscan output directories are created and then privacy-validated (including Windows ACL enforcement via requirePrivateScanOutput). |
| sdk/typescript/src/bulk-scan-discovery.ts | Applies the same privacy gate to bulk-scan wizard output roots after creation. |
| sdk/typescript/tests-ts/runtime.test.ts | Adds injectable Windows-ACL hook coverage plus a Windows-only integration test verifying ACL protection/current-user-only access. |
| sdk/typescript/tests-ts/multiscan.test.ts | Adjusts test directory setup to satisfy stricter privacy requirements for multiscan output roots. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Base chmod on the directory mode instead of umask, refresh metadata after correcting permissions, and clarify non-directory/symlink errors. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed the Copilot review notes:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55b9aac385
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Address Codex review: format sources for Prettier, chmod to exact 0700 when permission bits drift, and revalidate directory identity after ACL hardening before returning the canonical scan output path. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed the Codex review on
Focused suite: runtime, contract, multiscan, bulk-scan-discovery — all passing. |
|
@mldangelo-oai can you take a look over this again please, thanks. |
Summary
requirePrivateOutputDirectory/requireSecureOutputAncestryno-op onwin32) while credential homes already applied a current-user-only ACL.requirePrivateScanOutputand a sharedsecureWindowsPrivateDirectoryhelper; apply + verify ACL on prepare and on every contract scan-root check.Test plan
bun test --timeout 60000 ./tests-ts/runtime.test.ts ./tests-ts/contract.test.ts ./tests-ts/multiscan.test.ts ./tests-ts/bulk-scan-discovery.test.tssecureWindowsOutputis required for Windows scan-output privacyvalidatePreparedOutputDirinvokes the Windows ACL hook