Side by side
All rows come from each vendor's own docs. Check your version, because both tools change often.
| Setting | Claude Code | Codex CLI |
|---|---|---|
| Settings file | ~/.claude/settings.json, .claude/settings.json | ~/.codex/config.toml |
| The main dial | permissions.defaultMode: default, acceptEdits, plan, auto, dontAsk, bypassPermissions | approval_policy: on-request, never or granular. Plus sandbox_mode: read-only, workspace-write or danger-full-access |
| Starting point | Auto mode for interactive terminal and VS Code sessions from v2.1.283 | In a version-controlled folder, workspace-write with on-request. Otherwise read-only, or until you trust the folder |
| Sandbox | Off by default. Turn it on with /sandbox or sandbox.enabled | OS-enforced for local runs, with network off and writes limited to the workspace |
| Network | Sandboxed commands go through a proxy that checks hosts against network.allowedDomains, which starts empty | Off in workspace-write unless sandbox_workspace_write.network_access = true |
| What the sandbox wraps | Shell commands and the processes they start. File tools, local MCP servers and hooks run outside it | Commands Codex runs for the model |
| Protected paths | .git, .vscode, .idea, .claude and more get per-mode rules | .git, .agents, .codex and .aws stay read-only inside writable roots |
| Automatic reviewer | Auto mode's classifier | approvals_reviewer = "auto_review" |
| The "skip everything" switch | --dangerously-skip-permissions (bypass mode) | --dangerously-bypass-approvals-and-sandbox, alias --yolo |
| Lock it down for a team | permissions.disableBypassPermissionsMode in managed settings | allowed_sandbox_modes and allowed_approval_policies in managed requirements |
The difference that matters
Codex lets you stop the questions without removing the walls. --ask-for-approval never only turns off prompts, and it works with every sandbox mode, so --sandbox workspace-write --ask-for-approval never keeps the OS sandbox on. Removing both takes --yolo, or --sandbox danger-full-access with approvals off. The docs list the --yolo combination as "No sandbox; no approvals (not recommended)."
Claude Code's skip switch is one setting, and the sandbox is a separate thing you have to enable. Even in bypass mode, deny rules still block, so a deny list is worth writing in both tools.
Also note the retired setting. Codex no longer supports approval_policy = "untrusted", and leaving it in a config can stop the client from starting. For an interactive read-only run, use sandbox_mode = "read-only" with approval_policy = "on-request".
A cautious config for each
Claude Code, in ~/.claude/settings.json:
{
"permissions": {
"deny": ["Read(./.env)", "Read(./.env.*)", "Bash(git push --force *)"],
"ask": ["Bash(git push *)", "Bash(npm publish *)"],
"disableBypassPermissionsMode": "disable"
},
"sandbox": {
"enabled": true,
"allowUnsandboxedCommands": false
}
}Codex CLI, in ~/.codex/config.toml:
sandbox_mode = "workspace-write"
approval_policy = "on-request"
[sandbox_workspace_write]
network_access = falseSame goal, different knob
- Fewer prompts, same boundary. Claude: auto mode or
acceptEdits. Codex: keepon-requestinsideworkspace-write, or setapprovals_reviewer = "auto_review". - Unattended or CI runs. Claude:
dontAsk, orpermissions.denyInsteadOfPrompting. Codex:--sandbox read-only --ask-for-approval never, orcodex exec --sandbox workspace-write. - Let the agent reach the network. Claude: add hosts to
sandbox.network.allowedDomains. Codex: setnetwork_access = true, and turn on thenetwork_proxyfeature if you want domain rules to apply. - Run with no guardrails. Both vendors say to do it only inside a container or VM you are happy to lose.
Which one is safer?
Neither is, by itself. The honest comparison is by configuration, not by brand. Codex ships with its sandbox on, so its default boundary is tighter. Claude Code has a detailed permission-rule system, and you opt in to its sandbox. In both, a local MCP server is a separate risk, covered in Is an MCP server safe to install?.
Quick follow-ups
What is the Codex equivalent of --dangerously-skip-permissions?
--dangerously-bypass-approvals-and-sandbox, with the alias --yolo. Codex's docs describe it as no sandbox and no approvals, and not recommended. If you only want no prompts, use --ask-for-approval never with a sandbox mode instead.
Is the Claude Code sandbox on by default?
No. Anthropic's docs say the sandbox is off by default. Turn it on with /sandbox, or set sandbox.enabled to true in a settings file.
Does the Claude Code sandbox cover MCP servers?
No. The sandbox wraps shell commands. Built-in file tools, command hooks and local MCP servers run outside it, with your full access.
Sources
- Claude Code: Choose a permission mode
- Claude Code: Configure the sandboxed Bash tool
- Claude Code: Settings reference
- Codex: Agent approvals and security
- Codex: Configuration reference
- Codex: Command line options
See also the glossary and the other questions.
