Inside the Codex sandbox

OpenAI
OpenAI explains the Codex sandbox, a defense-in-depth mechanism restricting filesystem and network access for AI agents across macOS, Linux, and Windows.

Summary

OpenAI's Codex sandbox provides defense-in-depth protection for its AI coding agent by constraining command execution within the user's existing environment, rather than using separate VMs or containers. Users configure sandbox boundaries through permission profiles that define filesystem and network restrictions. The default :workspace profile allows writes within the workspace (keeping .git and .codex read-only), permits broad filesystem reads, and disables network access. The harness applies these profiles via a common cross-platform API, spawning commands under OS-specific mechanisms: Seatbelt on macOS, bubblewrap combined with seccomp-bpf on Linux, and Microsoft's MXC library on Windows (currently replacing the prior implementation). Network restrictions are enforced by a shared proxy that checks domain rules, ensuring DNS lookups occur only after approval. Layered configuration and managed requirements let enterprises constrain which profiles users can select, and the codex sandbox command exposes the same sandboxing to developers' own tools, such as wrapping an MCP server to limit its file writes and block network access.

(Source:OpenAI)