require_escalated approval does not disclose retained network policy during partial escalation
What version of Codex CLI is running?
codex-cli 0.169.0
What subscription do you have?
Pro
Which model were you using?
Not relevant; this concerns command approval and sandbox policy.
What platform is your computer?
macOS on Apple silicon, using Codex Desktop.
What issue are you seeing?
When a custom permission profile contains denied-read filesystem entries, an explicitly approved require_escalated command uses the partial-escalation path that retains filesystem protections. Current behavior also retains the owner-managed network allowlist.
The security behavior appears intentional, but the approval contract does not disclose it:
- the tool schema describes
require_escalatedas “unsandboxed execution”; - Codex asks the user to approve escalation;
- the user approves;
- the command remains subject to the owner network allowlist;
- the command then fails with an allowlist error.
Example error after approval:
Network access to "api.doppler.com" was blocked: domain is not on the allowlist for the current sandbox mode.
The same session reproduced this with Codex's own management CLI against ab.chatgpt.com and a nested codex exec attempt against api.openai.com.
The active profile intentionally had:
- workspace writes;
- denied-read globs for
**/.envand**/.env.*; - managed networking enabled;
- only loopback domains in the allowlist.
The equivalent third-party command reached its service from the user's normal terminal, confirming this was the effective Codex policy rather than host connectivity.
What steps can reproduce the bug?
- Configure a permission profile with a denied-read entry and a limited managed-network domain list:
default_permissions = "coding"
[features]
network_proxy = true
[permissions.coding]
extends = ":workspace"
[permissions.coding.filesystem.":workspace_roots"]
"**/.env" = "deny"
"**/.env.*" = "deny"
[permissions.coding.network]
enabled = true
[permissions.coding.network.domains]
"localhost" = "allow"
"127.0.0.1" = "allow"
- Restart Codex with that profile.
- Request a command that needs an unlisted public domain and explicitly uses:
{
"sandbox_permissions": "require_escalated",
"justification": "Run the authorized network command."
}
- Approve the command.
- Observe that the command still receives the managed-domain allowlist rejection.
Current main explains the implementation behavior:
sandbox_override_for_first_attemptselectsEscalatedSandboxWithRestrictionswhen denied reads must remain enforced.ToolOrchestratorkeepsmanaged_network_activeon that attempt.- The
ESCALATED_DENY_READintegration case incodex-rs/core/tests/suite/network_approval.rsexpects the owner network policy to remain enforced.
What is the expected behavior?
Do not silently weaken denied-read or owner network policy.
Instead, before asking for approval:
- State that the requested escalation cannot be fully unsandboxed because denied-read protections must remain active.
- State that the owner-managed network allowlist will remain active.
- Identify that approval alone will not grant the requested domain.
- Point to the supported scoped remedy, such as adding that domain to the active permission profile.
- Record the effective execution mode as partial/restricted escalation rather than presenting it as ordinary unsandboxed
require_escalated.
The tool schema and approval UI should not promise “unsandboxed execution” when the selected execution path intentionally preserves restrictions.
Additional information
Related but distinct reports:
- #49344 covers retained filesystem restrictions and missing diagnostics for browser tests.
- #15309 covers approved escalated commands retaining network restrictions more generally.
This report is specifically about accurately disclosing the combined denied-read plus owner-network behavior that current main appears to enforce intentionally.
No credentials, secret values, private repository paths, or device identifiers are included.
One source-specific implementation boundary beyond changing the "unsandboxed" wording: the present approval is emitted before the effective escalation and retained networking mode are computed. A UI patch that merely reports the execution result after approval cannot fix this misleading consent.
On current main:
ToolOrchestrator::runbuildsApprovalContextwithnetwork_approval_context: Noneand awaitssession.request_approval(...)in theNeedsApprovalpath (roughly L164–231). Only after that approval returns does it computesandbox_override_for_first_attempt(L237), itsEscalatedSandboxWithRestrictionsprofile, thenmanaged_network_active(roughly L303–330) and theSandboxAttempt(L377). So today's approval boundary does not carry a snapshot of the effective execution authority. The generic shell tool schema simultaneously promisesrequire_escalatedis "unsandboxed execution".sandbox_override_for_first_attemptdeliberately distinguishes denied-read restrictions from a true bypass. The orchestrator preserves owner-managed networking for the partial path. The existingESCALATED_DENY_READintegration scenario is an important positive test that this policy remains enforced, not a test that the approver was accurately informed.
Proposed narrow contract: derive a read-only EffectiveEscalationPreview from the same selected turn environment, request, denied-read policy and owner-network policy before constructing an approval request. Convey to the human approver the effective mode (full_bypass versus partial_restricted), that denied reads and/or owner network restrictions remain, and the specific attempted host's known allow/deny status where that host can reliably be determined. Keep the full owner allowlist private; do not show a guessed host or claim that command approval extends the allowlist. After approval, the selected execution attempt must be consistent with that preview; if a live policy/environment change makes it differ, require an updated review or reject, never silently widen authority or execute under a different undisclosed contract.
Acceptance controls:
- Denied reads + owner network denied + explicit
require_escalated: before approval, show restricted execution and that this approval alone cannot allow the target domain; rejecting does not run the command; approving cannot bypass the owner policy. Preserve the current 403 isolation test. - Same denied reads, but allowed target domain: still label
partial_restricted, command can proceed per policy; don't falsely tell the approver all networking is blocked. - No denied reads with an otherwise eligible full-bypass path: disclose the actually selected mode, not a hard-coded "all escalations are partial" banner. Distinguish any independent owner proxy requirement.
- Unknown or dynamically constructed domain: state that reachability cannot be guaranteed from approval; do not infer a policy grant. Check command execution after policy changes against the versioned preview.
- Assert that the approval event payload/visible human text, tool schema, execution mode, and resulting enforcement agree. A post-run error message by itself does not satisfy the pre-consent test.
Original-theory connection, not an endorsement claim: this engineering split between a recorded assent and the conditions under which it remains valid is an application of Nakagawa Master's 合意の記憶 — 不可逆な社会誤作動を防ぐ最小構造 (causal reason, parties/context, re-agreement). The source is a conceptual origin for this acceptance framing; the specific Rust behavior and tests above are from Codex, and I do not claim Codex developers have read, accepted or adopted the original.
Source review only; I have not executed the reporter's macOS profile or a Codex integration test.
Implementation bridge — effective escalation plan before consent
The concrete source seam is ToolOrchestrator: compute the execution/network escalation to be approved before asking for approval, then verify it is still the plan at launch. Minimal JavaScript reference for the preflight boundary, not a native Rust patch:
function approvalPreflight(request, effectivePlan, consent) {
if (!consent?.hostVerified) return 'request-approval';
if (consent.requestId !== request.id ||
consent.planFingerprint !== effectivePlan.fingerprint)
return 'reapprove';
if (consent.decision !== 'allow') return 'deny';
return 'launch-with-verified-plan';
}
Tests: policy allows retained network while UI only says “unsandboxed” → consent fingerprint must include the actual network/sandbox scope; changing that scope after consent → reapprove, not silently broaden execution; a different request ID cannot reuse an earlier approval; explicit denial stays denied. The fingerprint must be computed over a canonical host-owned plan containing effective sandbox restrictions, writable roots and retained network mode, and rechecked against what will launch with no time-of-check gap. The real fix requires moving/plumbing the effective-plan construction ahead of the request and binding launch to it; this is an executable decision core, not tested product code.