agent-approvals-security.md +36 −8
14Codex CLI, and IDE extension, see [sandboxing](https://learn.chatgpt.com/docs/sandboxing).14Codex CLI, and IDE extension, see [sandboxing](https://learn.chatgpt.com/docs/sandboxing).
15For a broader enterprise security overview, see the [Codex security white paper](https://trust.openai.com/?itemUid=382f924d-54f3-43a8-a9df-c39e6c959958&source=click).15For a broader enterprise security overview, see the [Codex security white paper](https://trust.openai.com/?itemUid=382f924d-54f3-43a8-a9df-c39e6c959958&source=click).
16 16
17## Migrate from the retired `untrusted` approval policy
18
19Codex and ChatGPT Work no longer support `approval_policy = "untrusted"`.
20The retired setting can prevent either client from starting. Remove it from
21user or project configuration, profile files, startup scripts, and managed
22defaults. For interactive, read-only use:
23
24```toml
25sandbox_mode = "read-only"
26approval_policy = "on-request"
27```
28
29Or run `codex --sandbox read-only --ask-for-approval on-request`.
30
31With `on-request`, commands allowed by the sandbox can run without approval,
32read accessible files, and use network access if enabled.
33
34To preserve the stricter command-approval rule, omit an explicit
35`approval_policy` and add a project entry to your user-level
36`~/.codex/config.toml`:
37
38```toml
39[projects."/path/to/project"]
40trust_level = "untrusted"
41```
42
43Commands then require approval unless an execution-policy rule allows them.
44This also disables project-local configuration. Explicitly setting `on-request`
45overrides the project-derived policy; managed `allowed_approval_policies` must
46include `untrusted` to permit it.
47
17## Sandbox and approvals48## Sandbox and approvals
18 49
19Codex security controls come from two layers that work together:50Codex security controls come from two layers that work together:
313### Common sandbox and approval combinations344### Common sandbox and approval combinations
314 345
315| Intent | Flags / config | Effect |346| Intent | Flags / config | Effect |
316347| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ || ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
317| Auto (preset) | _no flags needed_ or `--sandbox workspace-write --ask-for-approval on-request` | Codex can read files, make edits, and run commands in the workspace. Codex requires approval to edit outside the workspace or to access network. |348| Auto (preset) | _no flags needed_ or `--sandbox workspace-write --ask-for-approval on-request` | Codex can read files, make edits, and run commands in the workspace. Codex requires approval to edit outside the workspace or to access network. |
318349| Safe read-only browsing | `--sandbox read-only --ask-for-approval on-request` | Codex can read files and answer questions. Codex requires approval to make edits, run commands, or access network. || Safe read-only browsing | `--sandbox read-only --ask-for-approval on-request` | Codex can read files and run commands within the read-only sandbox. Actions outside the sandbox can require approval. |
319350| Read-only non-interactive (CI) | `--sandbox read-only --ask-for-approval never` | Codex can only read files; never asks for approval. || Read-only non-interactive (CI) | `--sandbox read-only --ask-for-approval never` | Codex can read files and run commands within the read-only sandbox; it never asks for approval. |
320| Automatically edit but ask for approval to run untrusted commands | `--sandbox workspace-write --ask-for-approval untrusted` | Codex can read and edit files but asks for approval before running untrusted commands. |
321| Auto-review mode | `--sandbox workspace-write --ask-for-approval on-request -c approvals_reviewer=auto_review` or `approvals_reviewer = "auto_review"` | Same sandbox boundary as standard on-request mode, but eligible approval requests are reviewed by Auto-review instead of surfacing to the user. |351| Auto-review mode | `--sandbox workspace-write --ask-for-approval on-request -c approvals_reviewer=auto_review` or `approvals_reviewer = "auto_review"` | Same sandbox boundary as standard on-request mode, but eligible approval requests are reviewed by Auto-review instead of surfacing to the user. |
322| Dangerous full access | `--dangerously-bypass-approvals-and-sandbox` (alias: `--yolo`) | <ElevatedRiskBadge /> No sandbox; no approvals _(not recommended)_ |352| Dangerous full access | `--dangerously-bypass-approvals-and-sandbox` (alias: `--yolo`) | <ElevatedRiskBadge /> No sandbox; no approvals _(not recommended)_ |
323 353
324For non-interactive runs, use `codex exec --sandbox workspace-write`; Codex keeps older `codex exec --full-auto` invocations as a deprecated compatibility path and prints a warning.354For non-interactive runs, use `codex exec --sandbox workspace-write`; Codex keeps older `codex exec --full-auto` invocations as a deprecated compatibility path and prints a warning.
325 355
326With `--ask-for-approval untrusted`, Codex runs only known-safe read operations automatically. Commands that can mutate state or trigger external execution paths (for example, destructive Git operations or Git output/config-override flags) require approval.
327
328#### Configuration in `config.toml`356#### Configuration in `config.toml`
329 357
330For the broader configuration workflow, see [Config basics](https://learn.chatgpt.com/docs/config-file/config-basic), [Advanced Config](https://learn.chatgpt.com/docs/config-file/config-advanced#approval-policies-and-sandbox-modes), and the [Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-reference).358For the broader configuration workflow, see [Config basics](https://learn.chatgpt.com/docs/config-file/config-basic), [Advanced Config](https://learn.chatgpt.com/docs/config-file/config-advanced#approval-policies-and-sandbox-modes), and the [Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-reference).
331 359
332```toml360```toml
333361# Always ask for approval mode# Interactive approvals with a read-only sandbox
334362approval_policy = "untrusted"approval_policy = "on-request"
335sandbox_mode = "read-only"363sandbox_mode = "read-only"
336allow_login_shell = false # optional hardening: disallow login shells for shell-based tools364allow_login_shell = false # optional hardening: disallow login shells for shell-based tools
337 365