Overview
OpenAI Codex is a Rust-based CLI agent with built-in sandboxing viasandbox-exec (macOS Seatbelt). Has process hardening (anti-debug, core dump prevention).
Binary path:
Config:
Dependencies:
License: Open source
~/.local/bin/codexConfig:
~/.codex/Dependencies:
$$require=55-integrations-optional/keychain.sb$$License: Open source
Sandbox Profile
Running in Safehouse
Codex sandboxes its own tool calls using macOS
sandbox-exec. Safehouse provides an additional outer layer of isolation for the Codex process itself.Built-in Sandbox Features
Codex’s internal sandbox:- Deny-by-default policy
.git/and.codex/protected from writes (even inWorkspaceWritemode)- Network proxy support (MITM routing for sandboxed processes)
- Parameterized policies for dynamic writable roots
Sandbox Policies
Process Hardening
Codex runs security measures before main(): macOS:ptrace(PT_DENY_ATTACH)— Prevent debugger attachmentsetrlimit(RLIMIT_CORE, 0)— Disable core dumps- Remove
DYLD_*env vars — Prevent library injection
prctl(PR_SET_DUMPABLE, 0)— Prevent ptracesetrlimit(RLIMIT_CORE, 0)— Disable core dumps- Remove
LD_*env vars — Prevent preload injection
MDM Integration
macOS Managed Preferences:Configuration Hierarchy
- Cloud requirements (highest)
- MDM managed preferences (macOS)
- System config (
/etc/codex/config.toml) - User config (
~/.codex/config.toml) - Project config (
.codex/config.tomlin cwd)
OAuth Flows
- ChatGPT login — Browser OAuth via
auth.openai.com - MCP OAuth — Ephemeral callback port
- Local server — Binds to
localhost:1455(default)