The Codex dangerously skip permissions flag is --dangerously-bypass-approvals-and-sandbox, alias --yolo: it turns off both approval prompts and the sandbox (OpenAI: Agent approvals & security). Codex has no --dangerously-skip-permissions; that spelling is the Claude Code flag.

codex --dangerously-bypass-approvals-and-sandbox

The CLI’s own help text for that flag reads: “Skip all confirmation prompts and execute commands without sandboxing. EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed.” (openai/codex, shared_options.rs at rust-v0.166.0). If what you want is only “stop asking me”, Codex has narrower options that keep the sandbox, listed below.

Applies to: OpenAI Codex CLI 0.166.0 (released October 29, 2026) and the Codex docs on developers.openai.com. Last checked: November 4, 2026.

On this page

Which flag to use instead

Codex splits “permissions” into two settings: the sandbox mode decides what commands can technically touch, and the approval policy decides when Codex stops to ask (Sandbox concepts). The bypass flag switches off both. Every row below is OpenAI’s documented combination (Agent approvals & security).

What you want Flags Sandbox Prompts
Edit and run commands in the repo, ask for anything outside --sandbox workspace-write --ask-for-approval on-request Workspace only, no network Only beyond the boundary
Same, but a reviewer agent answers the prompts --sandbox workspace-write --ask-for-approval on-request -c approvals_reviewer=auto_review Workspace only Sent to Auto-review
Edit freely, ask before untrusted commands --sandbox workspace-write --ask-for-approval untrusted Workspace only Before commands outside the trusted set
Read-only job with no prompts (CI) --sandbox read-only --ask-for-approval never Read-only None
Full access, nothing asked --dangerously-bypass-approvals-and-sandbox (alias --yolo) None None (“not recommended”)

As of rust-v0.166.0 the CLI also has a single flag for the Auto-review row: --approve-for-me, alias --not-so-yolo. In the source it sets approvals_reviewer="auto_review", approval_policy="on-request" and sandbox_mode="workspace-write", and it cannot be combined with --sandbox or the bypass flag (shared_options.rs). The docs page does not list this flag yet, so check codex --help on your version before you script it.

--ask-for-approval never keeps the sandbox

“You can disable approval prompts with --ask-for-approval never or -a never (shorthand). This option works with all --sandbox modes” (Agent approvals & security). So this runs without prompts and still cannot write outside the workspace:

codex --sandbox workspace-write --ask-for-approval never

When a command needs something the sandbox blocks, it fails instead of waiting for you. For scripts, OpenAI points to codex exec --sandbox workspace-write; the old codex exec --full-auto still runs but is “a deprecated compatibility path and prints a warning” (same page). JSON output, schemas and resume for scripted runs are in Codex exec non-interactive.

What usually blocked you, and the narrow fix

Most people reach for the bypass flag after one blocked action. Each block has its own documented setting:

Blocked action Narrow fix Source
A command needs the network (npm install, API call) [sandbox_workspace_write] with network_access = true in config.toml Approvals & security
Network is on, but should reach only some hosts [features.network_proxy] with enabled = true and a domains allow list Approvals & security
Writes to a second directory --add-dir, which the reference prefers “rather than forcing --sandbox danger-full-access” CLI reference
Edits to .git, .codex or .agents inside the repo None: these stay read-only in workspace-write, recursively Approvals & security
One command prefix outside the sandbox Rules that “allow, prompt, or forbid command prefixes” Sandbox concepts
Too many prompts of one kind approval_policy = { granular = { ... } }, covering sandbox, rules, MCP, request_permissions and skill-script prompts Approvals & security

The network settings, exactly as OpenAI gives them:

[sandbox_workspace_write]
network_access = true
[features.network_proxy]
enabled = true
domains = { "api.openai.com" = "allow", "example.com" = "deny" }

OpenAI notes that network_proxy “does not grant network access by itself”: with network_access off, the network stays off.

danger-full-access and the bypass flag are not the same switch

--sandbox danger-full-access removes only the sandbox; the approval policy still applies. The docs define full access as sandbox_mode = "danger-full-access" together with approval_policy = "never" (Sandbox concepts), which is what the bypass flag does in one go. Two side effects listed by OpenAI:

  • With --yolo “or another full access sandbox setting, web search defaults to live results” instead of the cached index (Agent approvals & security). Set web_search = "cached" or "disabled" if you do not want that.
  • Inside a container, danger-full-access or the bypass flag lets “a malicious project … exfiltrate anything available inside the devcontainer, including Codex credentials” (same page). OpenAI suggests that pattern “only with trusted repositories”.

OpenAI’s documented case for full access is Docker where the Linux sandbox cannot start: configure the container’s isolation, then run Codex with --sandbox danger-full-access or the bypass flag inside it. The CLI reference’s safety tip is to avoid the bypass flag “unless you are inside a dedicated sandbox VM” (CLI reference). On Windows, set up the native sandbox first; see Codex CLI on Windows.

Make a quiet mode the default

Profiles save a sandbox and approval pair so you do not retype flags. OpenAI’s example files (Agent approvals & security):

# ~/.codex/full_auto.config.toml
approval_policy = "on-request"
sandbox_mode    = "workspace-write"
# ~/.codex/readonly_quiet.config.toml
approval_policy = "never"
sandbox_mode    = "read-only"

Select one with codex --profile profile-name; the --profile help text says it layers $CODEX_HOME/<name>.config.toml on top of the base config (shared_options.rs). Profile precedence is covered in Codex configuration profiles. Mid-session, /permissions switches modes, for example between Auto and Read Only (CLI reference).

To see what the sandbox blocks before loosening it, Codex can run any command under its own policy:

# macOS
codex sandbox macos [--permissions-profile <name>] [--log-denials] [COMMAND]...
# Linux
codex sandbox linux [--permissions-profile <name>] [COMMAND]...
# Windows
codex sandbox windows [--permissions-profile <name>] [COMMAND]...