# Codex: set sandbox limits and approval policy

> News on WhatWorks · published 2026-11-16 · fresh until 2026-12-15 · https://whatworks.dev/t/codex-set-sandbox-and-approval-policy
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, sandbox limits and approval prompts are separate: `workspace-write` permits workspace edits with networking off by default; `never` suppresses prompts without widening access. Replace retired `untrusted` approval policy with `on-request`. Start with `codex --sandbox workspace-write --ask-for-approval on-request`.

**Not for:** Codex Security repository scanning.

Subjects: codex, security

Do first: For local workspace edits with interactive escalation, launch `codex --sandbox workspace-write --ask-for-approval on-request`.

## Short answer

The sandbox controls technical access; the approval policy controls when an action must pause. Disabling prompts does not expand the sandbox. The documented local default keeps command networking off.

## What to do

| Intent / control | Exact value / action |
| --- | --- |
| Workspace edits, interactive escalation | `codex --sandbox workspace-write --ask-for-approval on-request` |
| Read-only interactive session | `codex --sandbox read-only --ask-for-approval on-request` |
| Read-only non-interactive use | `codex --sandbox read-only --ask-for-approval never` |
| Prompt suppression | `--ask-for-approval never`, alias `-a never`; usable with every sandbox mode |
| Unrestricted local execution | `--sandbox danger-full-access`; `--dangerously-bypass-approvals-and-sandbox`, alias `--yolo`, disables both boundaries |
| Persistent configuration | `config.toml`: `sandbox_mode` selects `read-only`, `workspace-write` or `danger-full-access`; `approval_policy` selects `on-request`, `never` or a granular policy |
| Enable command network in workspace-write | `[sandbox_workspace_write]` with `network_access = true`; default is off |
| Current permissions / roots | `/permissions` changes mode; `/status` lists workspace directories; workspace includes current directory and temporary directories such as `/tmp` |
| Version-controlled folder recommendation | Auto = workspace-write plus on-request; non-version-controlled folders recommend read-only; untrusted directories may initially remain read-only |
| Protected paths within writable roots | `.git`, `.agents`, `.codex`, `.aws` remain recursively read-only; a `.git` pointer's resolved Git directory is protected too |

Remove retired `approval_policy = "untrusted"` from configuration, profiles and startup scripts; it can prevent startup. Use `sandbox_mode = "read-only"` plus `approval_policy = "on-request"` for interactive read-only operation. For stricter command approval, omit explicit `approval_policy` and set `trust_level = "untrusted"` in the user configuration's project entry. That disables project-local configuration; explicit on-request overrides the derived policy. Managed `allowed_approval_policies` must permit `untrusted` for that project-derived behavior.

For selective prompting, set `approval_policy = { granular = { ... } }`: boolean keys are `sandbox_approval`, `rules`, `mcp_elicitations`, `request_permissions`, `skill_approval`. The page's example sets the first three `true`, the last two `false`.

Approval reviewer defaults to `approvals_reviewer = "user"`. With interactive approval, `approvals_reviewer = "auto_review"` sends eligible requests to a reviewer; it adds model usage and does not change the sandbox. Managed `allowed_approvals_reviewers` can constrain this.

Command network access and hosted web search are separate. `web_search = "cached"` is the normal default; `live` matches `--search`; `disabled` turns search off; `indexed` gates external web access through the search index. Full-access modes default search to live. Command proxy rules do not filter search, apps, MCP or browser/computer-use traffic.

## Limits and open questions

- A custom approval policy does not override managed requirements. Local and cloud execution have separate policies.
- Granting network access alone does not impose domain restrictions; that requires the network-proxy configuration documented on the same page.
- Unrestricted execution removes the local protection boundary; read-only still permits commands that stay inside its constraints.

Not for: Codex Security repository scanning.

## Sources

- [Agent approvals & security](https://learn.chatgpt.com/docs/agent-approvals-security), OpenAI.
- [Markdown version](https://learn.chatgpt.com/docs/agent-approvals-security.md), OpenAI.

## Checked

2026-11-18; rechecked Agent approvals & security, including untrusted migration, sandbox defaults, network separation and approval combinations; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.