When a coding agent runs shell commands on a developer's machine, two failure modes matter most: unintended writes outside the project repository and silent exfiltration of local credentials over the network.

Rather than forcing every build and test run into a remote container or virtual machine, OpenAI's Codex sandbox—detailed on November 18, 2026—uses an existing-environment sandbox model. Keeping execution on the host lets the agent use local SDKs, simulators, and compilers without duplicating the environment, while relying on operating-system primitives to restrict what spawned commands can touch.

OS-Native Enforcement Layers

When the Codex CLI, desktop app, or IDE extension invokes a tool such as git, a test runner, or a package manager, it wraps the child process in platform-specific containment:

Platform Containment Mechanism Enforcement Model
macOS Apple Seatbelt (sandbox-exec, SBPL) (deny default) profile restricting writes and syscalls
Linux Bubblewrap + seccomp-bpf / Landlock Mount/user namespaces paired with syscall filtering
Windows Restricted tokens, ACLs, WFP Write-restricted process tokens and network filtering without admin elevation

Asymmetric Filesystem Rules: Narrow Writes, Broad Reads

Under the standard :workspace profile, Codex separates write and read permissions sharply:

  • Workspace-scoped writes: Modifications are confined to the active repository or designated workspace root.
  • Protected internal paths: Even inside the workspace, paths that could alter execution outside the sandbox—such as .git/hooks and .codex/config.toml—are forced read-only so an agent cannot plant a hook that fires later on the developer's normal shell.
  • Broad reads: Read access generally follows the host user's OS permissions because compilers, linkers, and language runtimes routinely read global libraries and SDKs outside the project directory.

That asymmetry creates a clear operational trade-off: if a sensitive API key or SSH key on disk is readable by your user account, write-blocking alone does not prevent the agent from reading it. Secrets should live outside standard readable dotfiles or behind credential-injecting proxies.

Network Lockdown and Proxy Dependencies

Network access is disabled by default in standard workspace profiles. When a workflow requires package downloads or specific endpoints, Codex routes traffic through a controlled host proxy or bridge to enforce domain allowlists.

As OpenAI's documentation notes, domain filtering depends on that proxy remaining active. If the proxy is disabled, or if wildcard rules and DNS-encoded hostnames are left unchecked, strict domain-level containment does not hold.

Risks Outside the Sandbox Boundary

Kernel sandboxing controls what the wrapped process does directly, but it cannot automatically govern indirect execution triggered by other tools on the machine:

  1. Ignored workspace dependencies: If an agent writes malicious code inside node_modules/ or a similar local cache, an editor plugin or external watcher running outside the sandbox may execute it later.
  2. Unwrapped stdio MCP servers: External Model Context Protocol servers launched via stdio must be explicitly wrapped in the sandbox profile; otherwise they inherit host permissions.

This analysis reflects OpenAI's published architectural documentation; independent red-team testing against adversarial bypasses has not been published. Before rolling out agentic CLI tools in a team setting, verify three conditions locally: read-only task isolation, workspace write boundaries (including .git/hooks), and behavior when network access is disabled.