Skip to content

Clarify sandbox permission override helper semantics - #13703

Merged
charley-oai merged 2 commits into
mainfrom
clarify-sandbox-permission-semantics
Mar 6, 2026
Merged

Clarify sandbox permission override helper semantics#13703
charley-oai merged 2 commits into
mainfrom
clarify-sandbox-permission-semantics

Conversation

@charley-oai

@charley-oai charley-oai commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Today SandboxPermissions::requires_additional_permissions() does not actually mean "is WithAdditionalPermissions". It returns true for any non-default sandbox override, including RequireEscalated. That broad behavior is relied on in multiple main callsites.

The naming is security-sensitive because SandboxPermissions is used on shell-like tool calls to tell the executor how a single command should relate to the turn sandbox:

  • UseDefault: run with the turn sandbox unchanged
  • RequireEscalated: request execution outside the sandbox
  • WithAdditionalPermissions: stay sandboxed but widen permissions for that command only

Problem

The old helper name reads as if it only applies to the WithAdditionalPermissions variant. In practice it means "this command requested any explicit sandbox override."

That ambiguity made it easy to read production checks incorrectly and made the guardian change look like a standalone main fix when it is not.

On main today:

  • shell and unified_exec intentionally reject any explicit sandbox_permissions request unless approval policy is OnRequest
  • exec_policy intentionally treats any explicit sandbox override as prompt-worthy in restricted sandboxes
  • tests intentionally serialize both RequireEscalated and WithAdditionalPermissions as explicit sandbox override requests

So changing those callsites from the broad helper to a narrow WithAdditionalPermissions check would be a behavior change, not a pure cleanup.

What This PR Does

  • documents SandboxPermissions as a per-command sandbox override, not a generic permissions bag
  • adds requests_sandbox_override() for the broad meaning: anything except UseDefault
  • adds uses_additional_permissions() for the narrow meaning: only WithAdditionalPermissions
  • keeps requires_additional_permissions() as a compatibility alias to the broad meaning for now
  • updates the current broad callsites to use the accurately named broad helper
  • adds unit coverage that locks in the semantics of all three helpers

What This PR Does Not Do

This PR does not change runtime behavior. That is intentional.

Co-authored-by: Codex <noreply@openai.com>
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

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

Co-authored-by: Codex <noreply@openai.com>
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

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

Copy link
Copy Markdown
Contributor

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: bd55d3c640

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

Comment thread codex-rs/protocol/src/models.rs

@dylan-hurd-oai dylan-hurd-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

naming is hard - good suggestion!

@charley-oai
charley-oai merged commit cb1a182 into main Mar 6, 2026
53 of 57 checks passed
@charley-oai
charley-oai deleted the clarify-sandbox-permission-semantics branch March 6, 2026 17:57
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 6, 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