Codex does not have one permission switch. It has two, and they do different jobs:
- Sandbox (
-s,--sandbox) is enforcement. The operating system stops a command from writing outside the allowed folders or reaching the network, whatever the model intended. - Approval policy (
-a,--ask-for-approval) is conversation. It decides whether Codex asks you before it does something the sandbox would block.
On codex-cli 0.163.0 the values are:
| Flag | Value | What it means |
|---|---|---|
--sandbox | read-only | Codex can inspect files. It cannot edit them or run commands without approval. |
--sandbox | workspace-write | Edits and routine commands inside the workspace. Network is off by default. |
--sandbox | danger-full-access | No sandbox. No filesystem or network boundary. |
--ask-for-approval | on-request | The model asks when it needs to go beyond the sandbox. |
--ask-for-approval | never | Never asks. A blocked command simply fails and the failure goes back to the model. |
Older guides also mention untrusted and on-failure. The current CLI rejects both on the command line (invalid value 'untrusted' for '--ask-for-approval'). OpenAI's docs call untrusted retired and on-failure deprecated, and warn that a leftover untrusted in config can stop Codex from starting.
The useful combinations:
# Read only: look, change nothing
codex --sandbox read-only --ask-for-approval on-request
# Auto: edit the workspace, ask before going further (the recommended default)
codex --sandbox workspace-write --ask-for-approval on-request
# Full access: no fence, no questions
codex --sandbox danger-full-access --ask-for-approval never