What is a sandbox?
A sandbox is an operating-system boundary on what the commands an agent runs can read, write and reach on the network. It is separate from approval, which decides whether a command runs at all. Claude Code sandboxes Bash with Seatbelt on macOS and bubblewrap on Linux and WSL2; Codex offers --sandbox read-only, workspace-write and danger-full-access.
- In Polish
- Sandbox
- First set up at
- Level 2, free guide
- Also searched as
- sandboxing, sandbox policy, OS sandbox
$59.99 once for 12 months of access. Nothing renews on its own. 30-day refund on a first purchase.
Why it matters.
Approval and the sandbox answer different questions. Approval decides whether a command runs and who says yes; the sandbox limits what a running command can read, write and reach. A deny rule on Bash(curl *) stops curl, not python -c opening a socket; the sandbox stops both. A reviewer model such as auto mode judges intent and does not contain a process, so run it inside the sandbox, not instead of it.
One connection, two layers
A deny rule on Bash(curl *) and an OS sandbox, each facing a socket opened with python -c.
- Judges the command text
- A process or boundary that runs
- What you can rely on
Approval rule Reads the command
-
The rule
Bash(curl *)inpermissions.denyThe approval layer judges the command string before it runs.
-
The command
python -copens a socketNo
curlin the text.sh -c 'curl …'slips past the same rule. -
The check
No pattern matches
The rule stops
curl. It does not stop the socket. -
What you can rely on
The spellings the rule matches
Treat command rules as a first filter; the network allowlist is the egress control.
OS sandbox Enforced by the OS
-
The boundary
Sandbox with a domain allowlist
The operating system enforces it on the running process: Seatbelt on macOS, bubblewrap on Linux and WSL2.
-
The command
python -copens a socketThe same command, to a host that is not on the allowlist.
-
The check
The sandbox proxy stops the connection
An unlisted host is stopped at the proxy: its first use prompts, or the classifier decides in auto mode, and
strictAllowlistdenies it outright. -
What you can rely on
Both are stopped
In Claude Code it covers shell commands only: Read, Edit and Write obey permission rules, not the sandbox.
Three layers every agent run needs
The vendors use different words for the same three questions. A strong answer to one does not cover the others.
| Layer | The question it answers | Claude Code | Codex | Cursor |
|---|---|---|---|---|
| Approval | Does this action run, and who says yes? | Permission modes and allow/ask/deny rules | Approval policy and auto-review | Run modes: Auto-review, Allowlist and Run Everything |
| OS sandbox | What can a running command read and write? | Sandboxed Bash tool | Sandbox or permission profile | Sandbox for shell commands |
| Network egress | Where can a running command connect? | Sandbox proxy with a domain allowlist | Profile network setting | Not verified |
How each tool does it.
Cursor, Claude Code and Codex each name this their own way. Each note carries the date it was checked.
Cursor
Cursor’s Run modes page lists Auto-review (the recommended default since Cursor 3.6), Allowlist and Run Everything, and says Auto-review is not a security boundary (checked 2026-10-12). Sandboxing can be switched on per run through the SDK (local.sandboxOptions), and /sandbox is listed among the CLI slash commands. The default write boundary and network are not verified.
Permissions and sandboxes guide (Cursor), 2026-09-26
Claude Code
Sandboxed Bash: Seatbelt on macOS, bubblewrap on Linux and WSL2, not native Windows. It covers shell commands only; Read, Edit and Write follow permission rules.
If bubblewrap or socat is missing, Claude Code warns and runs commands unsandboxed unless sandbox.failIfUnavailable is true in managed settings. Run /sandbox in a session: if it shows only a Dependencies tab, the sandbox is not running.
Permissions and sandboxes guide, Claude Code 2.1.283, 2026-09-26
Codex
--sandbox read-only, workspace-write or danger-full-access; permission profiles (beta) are preferred, and the two systems do not compose.
Approval is a separate setting: codex exec always runs with approval never unless you pass --approve-for-me, and the :workspace profile writes the workspace but grants no network.
Permissions and sandboxes guide, Codex 0.157.1, 2026-09-26
Questions about the sandbox.
Is a sandbox the same as an approval mode?
No. Approval, meaning Claude Code’s permission modes or Codex’s approval policy, decides whether an action runs and who says yes. The sandbox limits what a running command can read, write and reach. Setting approval_policy = "never" in Codex removes the prompts but does not widen or narrow the sandbox, so set both explicitly.
Does a sandbox cover everything the agent does?
No. Claude Code’s sandbox covers shell commands only; the Read, Edit and Write tools obey permission rules instead. Outside every layer sits the environment itself: the container or VM the agent runs in and the credentials it holds.
Does a sandbox matter in a headless run?
Yes, because nobody can answer a prompt. codex exec always runs with approval never, so a command that needs approval outside the sandbox is refused. claude -p starts in Manual mode (auto mode on third-party providers or with telemetry off, from v2.1.285), so pass --permission-mode dontAsk to deny whatever would prompt on every provider, and you turn its sandbox on explicitly, for example with --settings '{"sandbox":{"enabled":true,"allowUnsandboxedCommands":false}}'.
Is --full-auto still a Codex flag?
Not in 0.157.1: it is gone from codex --help. -a accepts only on-request and never, and the sandbox is a separate choice: --sandbox read-only, workspace-write or danger-full-access.
Keep reading.
The guides that go deeper, and the terms and comparisons next to this one.
Does this page answer your questions?
One tap, no sign-in.
What are you here for?
What is holding you back?
How does it read?
Thanks. If you left an email, Michał will reply.
Answering your questions?
One tap each. Close whenever you like.
no sign-in
Read the guides in the same words.
Open every guide with the Toolkit. Each term is defined once here, and the guides use it the same way.
$59.99 once for 12 months of access. Nothing renews on its own. 30-day refund on a first purchase.
Michał replies, not a bot. The address is used for this reply only.