feat(sandbox): add Windows deny-read parity#18202
Conversation
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/windows-sandbox-rs/src/lib.rs
Lines 420 to 423 in 954e7c2
The restricted-token path only adds additional_deny_write_paths when the path already exists. New deny-read logic later materializes missing deny paths (apply_deny_read_acls), so a FileSystemAccessMode::None path that starts missing gets read-denied but not write-denied. A sandboxed process can still create/write descendants under that directory, violating None semantics.
codex/codex-rs/windows-sandbox-rs/src/lib.rs
Lines 420 to 423 in 954e7c2
The restricted-token path only adds additional_deny_write_paths when the path already exists. New deny-read logic then materializes missing deny paths (apply_deny_read_acls), so a missing FileSystemAccessMode::None path becomes read-denied but not write-denied. A sandboxed command can still create/write under that directory, violating None semantics.
ℹ️ 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".
4db0235 to
e665898
Compare
ec765ef to
1013499
Compare
|
Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
1013499 to
b3d65de
Compare
Co-authored-by: Codex <noreply@openai.com>
bdeee66 to
5ace284
Compare
bolinfest
left a comment
There was a problem hiding this comment.
Still reviewing, but I wanted to send what I found so far...
| exclude_tmpdir_env_var: true, | ||
| exclude_slash_tmp: true, | ||
| }; | ||
| let file_system_policy = FileSystemSandboxPolicy::restricted(vec![ |
There was a problem hiding this comment.
I feel like we should create a macro or function that takes the TOML for config.toml because I find these test setups really hard to read...
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Why
The split filesystem policy stack already supports exact and glob
access = noneread restrictions on macOS and Linux. Windows still needed subprocess handling for those deny-read policies without claiming enforcement from a backend that cannot provide it.Key finding
The unelevated restricted-token backend cannot safely enforce deny-read overlays. Its
WRITE_RESTRICTEDtoken model is authoritative for write checks, not read denials, so this PR intentionally fails that backend closed when deny-read overrides are present instead of claiming unsupported enforcement.What changed
This PR adds the Windows deny-read enforcement layer and makes the backend split explicit:
glob_scan_max_depthwhen expanding Windows deny-read globs.WRITE_RESTRICTEDtoken model is not authoritative for read denials.Landed prerequisites
These prerequisite PRs are already on
main:feat(permissions): add glob deny-read policy supportfeat(sandbox): add glob deny-read platform enforcementfeat(config): support managed deny-read requirementsThis PR targets
maindirectly and contains only the Windows deny-read enforcement layer.Implementation notes
Verification
cargo test -p codex-core windows_restricted_token_rejects_unreadable_split_carveoutsjust fmtjust fix -p codex-corejust fix -p codex-windows-sandbox