PTS security notes / Questions

Claude Code vs Codex CLI: permission settings compared

By PTS · Published December 5, 2026 · Docs checked December 5, 2026

Short answer

Codex CLI uses two separate settings, sandbox_mode for what commands can technically touch and approval_policy for when it asks you, and its local sandbox is on by default. Claude Code uses one permission mode plus an optional Bash sandbox that stays off until you turn it on.

Side by side

All rows come from each vendor's own docs. Check your version, because both tools change often.

SettingClaude CodeCodex CLI
Settings file~/.claude/settings.json, .claude/settings.json~/.codex/config.toml
The main dialpermissions.defaultMode: default, acceptEdits, plan, auto, dontAsk, bypassPermissionsapproval_policy: on-request, never or granular. Plus sandbox_mode: read-only, workspace-write or danger-full-access
Starting pointAuto mode for interactive terminal and VS Code sessions from v2.1.283In a version-controlled folder, workspace-write with on-request. Otherwise read-only, or until you trust the folder
SandboxOff by default. Turn it on with /sandbox or sandbox.enabledOS-enforced for local runs, with network off and writes limited to the workspace
NetworkSandboxed commands go through a proxy that checks hosts against network.allowedDomains, which starts emptyOff in workspace-write unless sandbox_workspace_write.network_access = true
What the sandbox wrapsShell commands and the processes they start. File tools, local MCP servers and hooks run outside itCommands 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 reviewerAuto mode's classifierapprovals_reviewer = "auto_review"
The "skip everything" switch--dangerously-skip-permissions (bypass mode)--dangerously-bypass-approvals-and-sandbox, alias --yolo
Lock it down for a teampermissions.disableBypassPermissionsMode in managed settingsallowed_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:

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:

toml
sandbox_mode = "workspace-write"
approval_policy = "on-request"

[sandbox_workspace_write]
network_access = false

Same goal, different knob

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

See also the glossary and the other questions.

Get the free checklist

A 9-page worksheet plus starter files for Claude Code and Codex. Download it on Gumroad. This site does not collect email.

Get the free checklist

Wallet side of things? Get Don't Get Drained, also free. Or get both in one checkout.

Related guides

More questions