# Risk map — openai/codex

> Canonical page: https://codevetter.com/unpack/codex/risk-map

# Risk map — openai/codex

Scanned commit a1f40f3f1326eff7c81b860a4f4e27c1be186e10 (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

The highest-risk surfaces are command execution, the sandbox policy resolver, auth token storage, and the app-server stdio API that can drive all of the above. `codex-core` is an explicit blast-radius hotspot the repo asks contributors not to grow. Large orchestration files (`chatwidget.rs`, `app.rs`, `chat_composer.rs`, `codex.rs`) are fragile coupling points. History compaction and context fragments can invalidate the model prompt cache or exceed token caps. Sandbox escapes are the security property the project exists to protect; tests often skip them under nested sandbox. Legacy v1 app-server methods still exist and must not gain new surface.
- Shell-out is the primary security boundary. Tool handlers spawn user-model-supplied commands. Safety depends on `SandboxPolicy`, execpolicy allow/deny, and the platform sandbox all agreeing. A mismatch between the approval overlay and the spawn path is a command-execution bug. — [codex-rs/core/src/sandboxing/mod.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/sandboxing/mod.rs) [codex-rs/core/src/tools/router.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/tools/router.rs) [docs/sandbox.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/sandbox.md)
- `danger-full-access` and approval `never` disable the sandbox and prompts. Config, CLI flags, and execpolicy can each select this. Any new flag that defaults toward this combination widens blast radius for every SDK and CI caller. — [docs/sandbox.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/sandbox.md) [codex-rs/protocol/src/protocol.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/protocol/src/protocol.rs) [docs/config.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/config.md)
- Auth secrets live in `$CODEX_HOME/auth.json` (default `~/.codex/auth.json`) and may also be supplied by `CODEX_API_KEY`. The file contains access and refresh tokens. Log paths and debug traces that dump request headers would leak them. — [docs/authentication.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/authentication.md) [codex-rs/login/src/auth/manager.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/login/src/auth/manager.rs) [codex-rs/core/src/client.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/client.rs)
- The macOS sandbox uses Seatbelt (`sandbox-exec`) profiles built in `sandboxing/src/seatbelt.rs`. Tests that themselves call Seatbelt exit early when `CODEX_SANDBOX=seatbelt`, so nested-agent runs do not exercise the real profile. Profile edits are easy to ship untested. — [codex-rs/sandboxing/src/seatbelt.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/sandboxing/src/seatbelt.rs) [AGENTS.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/AGENTS.md) [docs/sandbox.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/sandbox.md)
- Linux isolation depends on `codex-linux-sandbox` (bubblewrap) plus Landlock. If bwrap is missing, the core falls back according to config (`sandbox_mode` and network flags). A silent downgrade is a security bug; the code path is in `core/src/sandboxing/mod.rs`. — [codex-rs/linux-sandbox/src/lib.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/linux-sandbox/src/lib.rs) [codex-rs/core/src/sandboxing/mod.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/sandboxing/mod.rs) [docs/sandbox.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/sandbox.md)
- Network access inside the sandbox is denied by default and selectively re-enabled. The env var `CODEX_SANDBOX_NETWORK_DISABLED` is also used by the agent harness to skip networked tests. AGENTS.md forbids modifying code related to `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR` or `CODEX_SANDBOX_ENV_VAR`. — [AGENTS.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/AGENTS.md) [codex-rs/core/src/sandboxing/mod.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/sandboxing/mod.rs)
- App-server stdio is a local trust boundary, not a remote auth boundary. Any process that can spawn `codex app-server` can start turns, exec commands, and read thread history. Experimental methods are gated but still compiled in. — [codex-rs/app-server/README.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/app-server/README.md) [codex-rs/app-server/src/lib.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/app-server/src/lib.rs) [codex-rs/app-server-protocol/src/protocol/common.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/app-server-protocol/src/protocol/common.rs)
- TUI orchestration files are called out as high-touch and should not grow: `tui/src/app.rs`, `bottom_pane/chat_composer.rs`, `bottom_pane/footer.rs`, `chatwidget.rs`, `bottom_pane/mod.rs`. New behavior belongs in a new module. These files are the most likely merge-conflict and regression sites. — [AGENTS.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/AGENTS.md) [codex-rs/tui/src/chatwidget.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/tui/src/chatwidget.rs) [codex-rs/tui/src/app.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/tui/src/app.rs)
- Context rules are load-bearing for cost and correctness: no history rewrite, no unbounded injected items, hard cap, and a P0 review if a fragment can exceed 1k tokens. Compact and new system fragments are the usual way to violate this. — [AGENTS.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/AGENTS.md) [codex-rs/core/src/context/mod.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/context/mod.rs)
- File IO outside the repo is normal and expected: `CODEX_HOME` (`~/.codex`), session JSONL, shell cwd, and apply_patch targets. Workspace-write mode still allows writes anywhere inside the writable roots derived from cwd and config `writable_roots`. Path canonicalization bugs become arbitrary-write bugs. — [docs/sandbox.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/docs/sandbox.md) [codex-rs/core/src/sandboxing/mod.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/core/src/sandboxing/mod.rs) [codex-rs/apply-patch/src/lib.rs](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/codex-rs/apply-patch/src/lib.rs)
- Change-size guidance caps non-mechanical diffs at about 800 lines and complex logic at 500. Oversized patches to `codex.rs` or `chatwidget.rs` are the usual review failure mode, not a compiler failure. — [AGENTS.md](https://github.com/openai/codex/blob/a1f40f3f1326eff7c81b860a4f4e27c1be186e10/AGENTS.md)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
