Codex Manual
Permissions and Safety
Codex can edit files and run commands. Keep the boundaries clear.
Two core concepts:
- Sandbox controls what Codex can access and write.
- Approval controls when Codex must ask before running commands or escalating access.
Recommended start:
codex --sandbox workspace-write --ask-for-approval on-requestThree sandbox modes (sandbox_mode):
| Mode | Meaning |
|---|---|
read-only | Read files only; editing or running commands needs approval |
workspace-write | Write in the workspace and temp directories and run routine local commands; network off by default |
danger-full-access | No sandbox restrictions |
Common approval policies (approval_policy) are on-request (run inside the sandbox, ask when going beyond it) and never (never ask, still bound by the sandbox). untrusted is no longer supported; for an old config that uses it, switch to sandbox_mode = "read-only" with approval_policy = "on-request".
By default a version-controlled folder uses workspace-write + on-request, and a folder without version control uses read-only; Codex may also start in read-only until you trust the directory. Use /permissions to switch inside a session. Under workspace-write, .git, .agents, .codex, and .aws stay read-only even inside writable roots.
Auto-review and network
Setting approvals_reviewer = "auto_review" (“Approve for me” in the App) sends eligible approval requests to a reviewer agent first instead of asking you each time. It does not change the sandbox boundary, uses extra model calls, and needs on-request. The default is user.
Network access is off by default under workspace-write; enable it in config.toml:
[sandbox_workspace_write]
network_access = trueYou can also pick a named permissions profile with default_permissions (built-in :read-only, :workspace, :danger-full-access), but do not combine it with sandbox_mode. Native Windows uses the Windows sandbox and does not require WSL.
Full access
Use full-access modes (--yolo, i.e. --dangerously-bypass-approvals-and-sandbox, or danger-full-access) only in disposable containers, temporary VMs, test-only directories, or environments with a clear rollback plan.
Good habits:
- Ask for a plan before edits.
- Review diffs after each change.
- Run relevant tests.
- Be careful with delete, migrate, overwrite, or privilege-escalating commands.
- Do not write secrets into repositories.