Skip to content
← All guides

Codex dangerously skip permissions and --yolo mode

The real Codex flag is --dangerously-bypass-approvals-and-sandbox, with the alias --yolo. See what it turns off, what stays on and safer options.

4 min read

Codex has no flag called --dangerously-skip-permissions. That name belongs to Claude Code. The Codex flag is --dangerously-bypass-approvals-and-sandbox, and the CLI reference lists --yolo as its alias. It turns off both approval prompts and the sandbox, so every command the model writes runs with your user’s full access. OpenAI’s own wording says to use it only inside an externally hardened environment.

What the flag does

The installed help for Codex CLI 0.166.0 describes it this way: it skips all confirmation prompts and executes commands without sandboxing. The help text calls it extremely dangerous and says it is intended solely for environments that are externally sandboxed. The CLI reference gives the same guidance and says codex exec should use it only inside an isolated runner.

Two protections go away at once.

ProtectionNormal behaviorWith the bypass flag
ApprovalsCodex pauses for your yes before a command, depending on the approval policyNo pauses
SandboxCommands run under a sandbox policy, which on macOS is SeatbeltNo sandbox

The docs also say web search defaults to live results when you run with --yolo or other full-access settings. Otherwise it defaults to cached results. The agent then reads live pages that can carry instructions, and it can act on them without asking.

The same thing in config

The flag has a config equivalent. In config.toml, a mode of danger-full-access removes the sandbox, and an approval policy of never removes the prompts. The permissions docs say the built-in :danger-full-access profile “removes local sandbox restrictions” and should be used only when that broad access is intentional. You can also pass -s danger-full-access or -a never as separate flags. Each one removes only half of the protection.

# ~/.codex/config.toml
sandbox_mode = "danger-full-access"
approval_policy = "never"

Avoid putting these in your user config. A user-level default applies to every project you open.

Separate hook flag

Codex 0.166.0 also lists --dangerously-bypass-hook-trust. It runs enabled hooks without persisted hook trust for one invocation. It does not remove the sandbox. See Codex hooks.

Safer options

Most work needs less than full access. Pick the narrowest option that finishes the task.

  • --sandbox workspace-write lets Codex edit the workspace and run local commands inside that boundary. Network access is off by default.
  • --ask-for-approval on-request lets the model decide when to ask you. The installed help lists only on-request and never.
  • --approve-for-me routes approval requests through automatic review inside the workspace-write sandbox. The docs give it the alias --not-so-yolo.
  • --add-dir <DIR> adds a writable folder next to the workspace, so you don’t have to open the whole disk.
  • --sandbox read-only suits a review where Codex should not write.

Details on each mode are in Codex sandbox.

When it is reasonable

The documented use case is a throwaway environment, such as a container or VM with no real credentials and no route to anything you care about. The environment is the boundary, so the agent’s own sandbox adds little. A laptop with your SSH keys, cloud credentials and a clone of your production repo is the opposite case.

If you do run it on a Mac, assume the agent can do anything your account can. Commit or stash first, keep secrets out of the environment and protect shared branches on the Git host. A bad plan, a typo or injected text in a web page can then delete files or force-push before you read the command. Speed is the risk here, since nothing stops a command between the model’s decision and its execution.

How to see what ran

Codex writes each session to a file you can read afterward. See Where Codex keeps session logs for the path and what to look for, including the command and its output.

Checked against the vendor documentation on November 25, 2026. Codex CLI reference · Agent approvals and security · Permissions · Config reference

Review the commands after the fact

Excellent’s free scan reads supported logs on the Mac and reports findings for review. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code. For a local report without installing an app, run the free scan. See a sample report.

Excellent Pro adds checks before supported actions. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Commands sent into an already running Codex shell fall outside that check. Pro can also configure Codex’s native Mac sandbox from your file and folder rules, with a plan to review first. Agent coverage · Sandbox setup · Pricing. Pro is US-only for now.

Related guides

View all