-s / --sandbox
The flag selecting the sandbox policy for model-generated shell commands — read-only / workspace-write / danger-full-access.
Specs
Verified:
- Kind
- Launch flag
- Syntax
- -s <MODE> / --sandbox <MODE>
- First seen
- —unverified
- Values
- read-only / workspace-write / danger-full-access
- In-session counterpart
- /permissions (in-session tier)
Official help verbatim: "Select the sandbox policy to use when executing model-generated shell commands", with values `read-only | workspace-write | danger-full-access`. An important interaction landed in 0.169.0: in untrusted directories, project config and MCP stay disabled even with `--sandbox workspace-write` (#60041, paired with the --trust flag on exec/review). First-seen version is unverified.
Timeline
- 0.169.0: in untrusted dirs, --sandbox workspace-write no longer enables project config and MCP (#60041)
Key features
- Three tiers: read-only / workspace-write / danger-full-access
- Governs only execution of model-generated shell commands
- Decoupled from directory trust since 0.169.0
Use cases
read-only for investigation; workspace-write when files must land; danger-full-access only in fully trusted environments.
Install
`codex -s workspace-write` or `codex exec -s read-only "..."`.
Caveats
Since 0.169.0, workspace-write ≠ project config/MCP loading — untrusted dirs need --trust.
Added
Updated
Verified