Skip to content

[codex] Fix elevated Windows sandbox named-pipe access#20270

Merged
iceweasel-oai merged 1 commit into
mainfrom
dev/iceweasel/sandbox-named-pipe-default-dacl
Apr 30, 2026
Merged

[codex] Fix elevated Windows sandbox named-pipe access#20270
iceweasel-oai merged 1 commit into
mainfrom
dev/iceweasel/sandbox-named-pipe-default-dacl

Conversation

@iceweasel-oai
Copy link
Copy Markdown
Collaborator

@iceweasel-oai iceweasel-oai commented Apr 29, 2026

Summary

  • add elevated-only token constructors that include the current token user SID in the restricted SID list
  • switch the elevated Windows command runner to use those constructors
  • leave the unelevated restricted-token path unchanged

Why

Windows named pipes created by tools like Ninja use the platform's default named-pipe ACL when no explicit security descriptor is provided. In the elevated sandbox, the pipe owner has access, but the write-restricted token can still fail its restricted-SID access check because the sandbox user SID was not in the restricting SID set. That causes child processes to exit successfully while Ninja never receives the expected pipe completion/close behavior and hangs.

Including the elevated sandbox user's SID in the restricting SID list lets the restricted check succeed for these owner-scoped pipe objects without broadening the unelevated sandbox to the real signed-in user.

Impact

  • fixes the minimal Ninja hang repro in the elevated Windows sandbox
  • preserves the existing unelevated sandbox behavior and write protections
  • keeps the change scoped to the elevated runner rather than changing shared token semantics
  • this does not affect file-writes for the sandbox because the sandbox users themselves do not receive any additional permissions over what the capability SIDs already have. In fact we don't even explicitly grant the sandbox user ACLs anywhere.

Validation

  • cargo build -p codex-windows-sandbox --quiet
  • verified the stock ninja.exe minimal repro exits normally on host and in the elevated sandbox
  • verified the same repro still hangs in the unelevated sandbox, which is the intended scope of this change
@iceweasel-oai iceweasel-oai changed the title [codex] Fix elevated Windows sandbox named-pipe access for Ninja [codex] Fix elevated Windows sandbox named-pipe access Apr 29, 2026
Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request Apr 29, 2026
- openai/codex#20270: thread token user SID into restricting-SID list for elevated Windows sandbox to fix Ninja named-pipe ACL access (merge-after-nits)
- BerriAI/litellm#26823: drop sensitive locals (client_messages, dynamic_callback_params, _response_headers) from re-raised error messages to prevent PII/secret leakage into exception payloads (merge-after-nits)
- BerriAI/litellm#26819: route team-callback + org-member mutation endpoints through _verify_team_access/_verify_org_access closing IDOR cluster, with 4xx-honest exception handling and comprehensive regression suite (merge-as-is)
@iceweasel-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Swish!

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

@iceweasel-oai iceweasel-oai marked this pull request as ready for review April 29, 2026 23:28
match &policy {
SandboxPolicy::ReadOnly { .. } => {
create_readonly_token_with_caps_from(base.raw(), &cap_psid_ptrs)
create_readonly_token_with_caps_and_user_from(base.raw(), &cap_psid_ptrs)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking, and I do not think this has security impact, but one small side effect worth calling out: this is a little broader than the named-pipe case. For example, an object that already grants CodexSandboxOffline access, such as a file owned by that sandbox account under its own profile, will now also satisfy the restricted-SID pass. If we ever wanted to keep read-only narrower, the follow-up would be to leave ReadOnly on the old helper and only opt it into this path once we have a concrete read-only repro that needs the broader behavior too. I think the current tradeoff is still reasonable because this is the dedicated sandbox account, not the real signed-in user.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@viyatb-oai yep, it is broader for sure. I addressed this in the PR with

this does not affect file-writes for the sandbox because the sandbox users themselves do not receive any additional permissions over what the capability SIDs already have. In fact we don't even explicitly grant the sandbox user ACLs anywhere.

Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai left a comment

Choose a reason for hiding this comment

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

lgtm with a non blocking comment

@iceweasel-oai iceweasel-oai merged commit 06f3b48 into main Apr 30, 2026
25 checks passed
@iceweasel-oai iceweasel-oai deleted the dev/iceweasel/sandbox-named-pipe-default-dacl branch April 30, 2026 19:06
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants