# Codex sandbox and approval modes, including --yolo

> How the Codex sandbox works: read-only, workspace-write and danger-full-access, when Codex asks, what --yolo turns off, and safer ways to get fewer prompts.

Updated November 17, 2026 · https://usecoral.app/guides/codex-sandbox

Codex runs every command it spawns inside an operating-system sandbox, and an approval policy decides when it stops to ask you. By default (the Auto preset) the sandbox is `workspace-write` and the policy is `on-request`: Codex edits files and runs commands in your project on its own, with no network, and asks before it writes outside the project or needs the internet. `--yolo` turns both layers off at once: no sandbox, no prompts.

As of November 2026, from OpenAI’s [sandboxing](https://learn.chatgpt.com/docs/sandboxing) and [agent approvals & security](https://learn.chatgpt.com/docs/agent-approvals-security) docs. OpenAI changes these often, so its pages win if they disagree. Part of [Keep coding agents safe](https://usecoral.app/guides/agent-safety).

<p data-cta="guide_top">When Codex stops to ask, it waits until you notice. Coral shows every waiting agent in your Mac’s notch and on your iPhone, so you answer in a second. <a href="/download">Download Coral for free</a></p>

## Two layers: the sandbox and the approval policy

People mix these up, and most surprises come from that.

- **The sandbox** (`sandbox_mode`, `--sandbox` or `-s`) is what commands *can* do: where they can write and whether they can reach the network. The operating system enforces it: Seatbelt (`sandbox-exec`) on macOS, bubblewrap plus seccomp on Linux and WSL2, and a native sandbox on Windows. It applies to every process Codex spawns, so `git`, `npm` and your test runner inherit it.
- **The approval policy** (`approval_policy`, `--ask-for-approval` or `-a`) is when Codex *stops and asks* before going past the sandbox.

| Sandbox mode | Commands can |
|---|---|
| `read-only` | Read files. Edits, and commands that need more than reading, need approval |
| `workspace-write` | Read, edit inside the workspace (your project plus temp folders like `/tmp`), run local commands. **Network off** |
| `danger-full-access` | Anything your user account can do, network included |

| Approval policy | Codex |
|---|---|
| `on-request` | Works inside the sandbox and asks when it needs to go beyond it |
| `never` | Never asks. What the sandbox blocks simply fails, and the error goes back to the model |
| granular | Keeps some prompt types interactive and auto-rejects the rest |

Run `/status` in a session to see which folders count as your workspace.

## Every mode, and when Codex asks

| You want | Flags | Asks you when |
|---|---|---|
| Auto (the default in a git repo) | `codex` or `-s workspace-write -a on-request` | Writing outside the project, using the network |
| Look, don’t touch | `-s read-only -a on-request` | Any edit or command that needs more than reading |
| CI, read-only, unattended | `-s read-only -a never` | Never. Writes fail |
| Unattended, but boxed | `-s workspace-write -a never` | Never. Network and outside writes fail |
| Approve for me | `-s workspace-write -a on-request -c approvals_reviewer=auto_review` | Only when the reviewer agent won’t clear it |
| Yolo | `--yolo` (`--dangerously-bypass-approvals-and-sandbox`) | Never, and nothing is boxed |

Inside a session, `/permissions` switches between these without restarting.

Two things the table hides:

- **`.git` is read-only even in `workspace-write`.** OpenAI protects `.git` (and a worktree’s real git folder), `.codex`, `.agents` and `.aws` inside writable roots. Codex can edit your code, but writing into `.git` (a commit, for example) is outside the box, so it asks under `on-request` and fails under `never`.
- **No network is the default, so installs ask.** `npm install`, `pip install` or a test that calls an API needs approval in Auto. That’s the most common prompt in a normal day.

<p data-cta="guide_body">Most Codex prompts are one-second answers: yes, install it. Coral puts them in your Mac’s notch with the full command, so you answer with one key instead of hunting for the tab. <a href="/download">Get Coral for free</a></p>

## What --yolo really turns off

`codex --yolo` is the short form of `--dangerously-bypass-approvals-and-sandbox`, and the same as `-a never -s danger-full-access`. Every command runs immediately, as you, on your real files, with full network. Unlike Claude Code’s `--dangerously-skip-permissions`, which only skips prompts, Codex’s flag also removes the sandbox. Two more side effects from OpenAI’s docs:

- **Web search goes live.** Codex normally searches a cached index of web results, which limits prompt injection from live pages. In full access it switches to live results.
- **Nothing stops a hidden prompt.** A README, an issue or a web page can tell the model to read `~/.ssh` or push with your git identity, and in yolo nothing pauses to ask you.

OpenAI’s own advice is to use full access only inside isolation you trust, like a container. Even then: “a malicious project can exfiltrate anything available inside the devcontainer, including Codex credentials.”

If you used `--full-auto` for fewer prompts: the [Codex changelog](https://learn.chatgpt.com/docs/changelog) tells `codex exec --full-auto` users to use `--sandbox workspace-write` instead. And `approval_policy = "untrusted"` is retired. If it’s still in your `config.toml`, Codex can fail to start; replace it with `on-request`, or with a `trust_level = "untrusted"` entry for that project.

## Fewer prompts without yolo

In order of how much they give away:

1. **Allow the network, with a domain list.** If installs are most of your prompts, allow network in the sandbox and limit where it can go:

   ```toml
   [sandbox_workspace_write]
   network_access = true

   [features.network_proxy]
   enabled = true
   domains = { "registry.npmjs.org" = "allow", "pypi.org" = "allow", "files.pythonhosted.org" = "allow" }
   ```

   Without the proxy feature, `network_access = true` means unrestricted outbound traffic. With it, the domain list is an allowlist and `deny` always wins.

2. **Widen the workspace, not the sandbox.** If Codex needs to write to a second folder (a shared package, a sibling repo), add it to `writable_roots` under `[sandbox_workspace_write]` instead of switching to full access.

3. **Rules for specific commands.** [Rules](https://learn.chatgpt.com/docs/agent-configuration/rules) allow, prompt for, or forbid command prefixes outside the sandbox. Allow the one command you approve all day; forbid the ones that must never run.

4. **Approve for me.** `approvals_reviewer = "auto_review"` sends requests that would have prompted you to a reviewer agent. It checks for data exfiltration, credential probing, weakening security and destructive actions, and denies critical-risk ones. It only sees actions that already needed approval, failures fail closed, and it uses extra model calls from your plan. See [auto-review](https://learn.chatgpt.com/docs/sandboxing/auto-review).

5. **Profiles for the rare cases.** Save a preset as `~/.codex/<name>.config.toml` and start it with `codex --profile <name>` when you mean it, instead of changing your default.

To see what the sandbox blocks before you change anything, run a command through it with `codex sandbox macos --log-denials <command>` (or `codex sandbox linux` / `windows`).

MCP tools have their own approval setting per server and per tool, separate from `approval_policy`; see [Codex MCP servers: add, approve and debug them](https://usecoral.app/guides/codex-mcp).

## Codex sandbox vs Claude Code sandbox

| | Codex | Claude Code |
|---|---|---|
| On by default | Yes, `workspace-write` | No, run `/sandbox` |
| What’s inside | Every command it spawns | Shell commands only. File tools, MCP servers and hooks run outside |
| Network by default | Off, ask to use it | Through a proxy, to domains you allow |
| Native Windows | Yes | No |
| Skip-everything flag | `--yolo` removes prompts **and** the sandbox | `--dangerously-skip-permissions` removes prompts; deny rules still apply |
| Second-opinion reviewer | Approve for me (`auto_review`) | Auto mode |

So Codex leans on the box and Claude Code leans on its classifier and your answers. Details on the Claude side: [Claude Code sandbox: what it covers](https://usecoral.app/guides/claude-code-sandbox) and [Is --dangerously-skip-permissions safe?](https://usecoral.app/guides/claude-code-dangerously-skip-permissions). For the bigger picture, see [Codex vs Claude Code](https://usecoral.app/guides/codex-vs-claude-code).

## Where Coral fits

The usual reason to reach for `--yolo` isn’t the prompt itself. It’s that the prompt sits unanswered while you’re in another tab, and the agent stops. [Coral](https://usecoral.app/features) fixes the waiting instead of the safety. It shows Codex (the CLI or the app) next to Claude Code, Copilot, OpenCode and Grok in your Mac’s notch, with whoever has waited longest first:

- **Answer with one key.** Press 1, 2 or 3 with the full command in front of you. ⌘Z takes it back within two seconds.
- **From any app.** A card drops from the notch when Codex asks; ⌃⌥1 answers without leaving your editor.
- **Away from your Mac.** Alerts on your iPhone are Free; answering from the phone straight to the agent is [Pro](https://usecoral.app/pricing).

You keep the sandbox on and stop paying for it in waiting time. That matters most for a long [Codex /goal](https://usecoral.app/guides/codex-goal) run, which keeps this same policy and waits at every prompt. Subagents inherit all of this from the parent session, so a custom agent can’t loosen or tighten it; see [Codex subagents](https://usecoral.app/guides/codex-subagents). Running several Codex sessions at once? See [Run several agents at once](https://usecoral.app/guides/run-multiple-claude-code-agents), and [Codex usage limits](https://usecoral.app/guides/codex-usage-limits) for what they cost your plan.

## Questions

### What is the Codex sandbox?

An operating-system boundary around every command Codex runs: Seatbelt on macOS, bubblewrap on Linux and WSL2, a native sandbox on Windows. In the default `workspace-write` mode, commands can edit only your project and temp folders and have no network.

### What does codex --yolo do?

It’s short for `--dangerously-bypass-approvals-and-sandbox`: approval policy `never` and sandbox `danger-full-access`. Codex runs every command without asking and without any isolation. Use it only inside a container or VM you treat as the boundary.

### How do I stop Codex asking for permission so often?

Look at what it asks for. If it’s installs, turn on `network_access` with a domain allowlist. If it’s one folder, add it to `writable_roots`. For the rest, add rules for specific commands or set `approvals_reviewer = "auto_review"`. All of these keep the sandbox on.

### Does Codex have network access?

Not by default. In `workspace-write`, commands have no network until you set `network_access = true` under `[sandbox_workspace_write]`, and Codex asks before a command that needs it. `danger-full-access` and `--yolo` have full network.

### Why can’t Codex commit in workspace-write mode?

Because `.git` is protected as read-only inside the sandbox. Writing to it is outside the box, so Codex asks first under `on-request`, and the commit fails under `never`.

### Is --full-auto still a Codex flag?

OpenAI’s changelog points `codex exec --full-auto` users to `--sandbox workspace-write`, which, with the default `on-request` policy, is what the Auto preset already does.
