Skip to content

feat: support restricted ReadOnlyAccess in elevated Windows sandbox#14610

Merged
viyatb-oai merged 4 commits intomainfrom
codex/viyatb/windows-readonly-support
Mar 18, 2026
Merged

feat: support restricted ReadOnlyAccess in elevated Windows sandbox#14610
viyatb-oai merged 4 commits intomainfrom
codex/viyatb/windows-readonly-support

Conversation

@viyatb-oai
Copy link
Collaborator

@viyatb-oai viyatb-oai commented Mar 13, 2026

Summary

  • support legacy ReadOnlyAccess::Restricted on Windows in the elevated setup/runner backend
  • keep the unelevated restricted-token backend on the legacy full-read model only, and fail closed for restricted read-only policies there
  • keep the legacy full-read Windows path unchanged while deriving narrower read roots only for elevated restricted-read policies
  • honor include_platform_defaults by adding backend-managed Windows system roots only when requested, while always keeping helper roots and the command cwd readable
  • preserve workspace-write semantics by keeping writable roots readable when restricted read access is in use in the elevated backend
  • document the current Windows boundary: legacy SandboxPolicy is supported on both backends, while richer split-only carveouts still fail closed instead of running with weaker enforcement

Testing

  • cargo test -p codex-windows-sandbox
  • cargo check -p codex-windows-sandbox --tests --target x86_64-pc-windows-msvc
  • cargo clippy -p codex-windows-sandbox --tests --target x86_64-pc-windows-msvc -- -D warnings
  • cargo test -p codex-core windows_restricted_token_

Notes

  • local cargo test -p codex-windows-sandbox on macOS only exercises the non-Windows stubs; the Windows-targeted compile and clippy runs provide the local signal, and GitHub Windows CI exercises the runtime path

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

SandboxPolicy::ReadOnly { .. } => {
let psid = convert_string_sid_to_sid(&caps.readonly).unwrap();
let (h, _) = super::token::create_readonly_token_with_cap(psid)?;

P1 Badge Enforce restricted read roots in legacy Windows sandbox

run_windows_sandbox_capture now accepts all ReadOnly policies, but this branch ignores the ReadOnlyAccess variant and always builds the same token path. The legacy restricted-token backend still only applies ACL changes for writable roots, so ReadOnlyAccess::Restricted in RestrictedToken mode does not enforce configured readable roots and can read more than policy intends.

ℹ️ 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".

@viyatb-oai
Copy link
Collaborator Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffcda22ea9

ℹ️ 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".

@viyatb-oai viyatb-oai changed the title feat: support restricted ReadOnlyAccess in Windows sandboxes feat: support restricted ReadOnlyAccess in elevated Windows sandbox Mar 13, 2026
@viyatb-oai
Copy link
Collaborator Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94c55d09a4

ℹ️ 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".

@viyatb-oai viyatb-oai force-pushed the codex/viyatb/windows-readonly-support branch from 63a8a1c to 933d96b Compare March 18, 2026 00:32
@viyatb-oai viyatb-oai merged commit d950543 into main Mar 18, 2026
33 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/windows-readonly-support branch March 18, 2026 02:08
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants