Skip to content

[codex] Bypass managed network for escalated exec#19595

Merged
viyatb-oai merged 3 commits intomainfrom
codex/viyatb/bypass-managed-network-for-escalated-exec
Apr 25, 2026
Merged

[codex] Bypass managed network for escalated exec#19595
viyatb-oai merged 3 commits intomainfrom
codex/viyatb/bypass-managed-network-for-escalated-exec

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Apr 25, 2026

Why

sandbox_permissions = "require_escalated" is treated as an explicit request to approve the command and run it outside the filesystem/platform sandbox. Before this change, shell and unified exec still registered managed network approval context and could inject Codex-managed proxy state into the child process, which meant an approved escalated command could still hit a second network approval path.

This PR makes that escalation boundary consistent: once a command is explicitly approved to run outside the sandbox, Codex does not also route that process through the managed network proxy.

Security impact

Command/filesystem sandbox approval now implies network approval for that command. If an untrusted command or script is allowed to run with require_escalated, its network calls are unsandboxed: Codex-managed network allowlists and denylists are not respected for that process, so the command can exfiltrate any data it can read.

What changed

  • Skip managed network approval specs for SandboxPermissions::RequireEscalated.
  • Pass network: None into shell, zsh-fork shell, and unified exec sandbox preparation for explicitly escalated requests.
  • Strip Codex-managed proxy environment variables when CODEX_NETWORK_PROXY_ACTIVE is present, while preserving user proxy env when the Codex marker is absent.
  • Add regression coverage for the prepared exec request so the old behavior cannot silently reappear.

Verification

  • cargo test -p codex-core explicit_escalation
  • cargo clippy -p codex-core --all-targets -- -D warnings

Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai marked this pull request as ready for review April 25, 2026 20:43
@viyatb-oai viyatb-oai requested a review from a team as a code owner April 25, 2026 20:43
@dylan-hurd-oai
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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/core/src/tools/runtimes/mod.rs
Comment thread codex-rs/core/src/tools/runtimes/mod_tests.rs
@bolinfest
Copy link
Copy Markdown
Collaborator

I think this is the right change, though I'm a little uncomfortable that these three files require similar changes:

codex-rs/core/src/tools/runtimes/shell/unix_escalation.rs
codex-rs/core/src/tools/runtimes/shell.rs
codex-rs/core/src/tools/runtimes/unified_exec.rs

I don't see a great way to consolidate them, but it admittedly takes effort to ensure we are applying this sort of logic consistently across our various shell tools.

Co-authored-by: Codex noreply@openai.com
@bolinfest bolinfest self-requested a review April 25, 2026 23:10
@viyatb-oai viyatb-oai enabled auto-merge (squash) April 25, 2026 23:11
@viyatb-oai viyatb-oai merged commit 9aaa5d9 into main Apr 25, 2026
25 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/bypass-managed-network-for-escalated-exec branch April 25, 2026 23:24
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 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.

3 participants