Filesystem and network boundaries, declared
The sandbox controls what the agent can do; approval mode controls when it asks first. Three modes: read-only (read files, no writes/commands), workspace-write (read all + write within workspace, no network by default), danger-full-access (no boundaries — sandbox VMs only).
Workspace-write is the default for local work. Codex CAN read anywhere, write inside the workspace, and run shell commands that stay in the workspace. It CANNOT write outside, hit the network, or touch protected paths (~/.ssh, ~/.aws, /etc) without explicit approval. --add-dir grants write access to specific extra directories without abandoning the sandbox model.
OS-level reinforcement: macOS Seatbelt and Linux Landlock provide kernel-enforced isolation in addition to Codex's policy. Even if config is misconfigured, the kernel-level layer blocks escapes. Run codex seatbelt -- npm test or codex landlock -- python -m pytest for the OS-enforced shell wrapper.