# Codex CLI starts with the network off and writes limited to the workspace, so the work is keeping it that way

GUIDE, read 12 Nov 2026

**The short answer.** OpenAI's Codex CLI runs commands in an OS-enforced sandbox with network off and writes limited to the workspace by default, plus an approval policy for leaving it. Three sandbox modes, requirements.toml for admins and OpenTelemetry export are covered, along with where the defaults stop and what remains.

## Codex separates what the sandbox allows from when the agent must ask

OpenAI's Codex security documentation builds on two settings. The sandbox mode sets what Codex can do technically when it runs model-generated commands, for example where it can write and whether it can reach the network. The approval policy sets when Codex must stop and ask before it acts, for example before leaving the sandbox, using the network or running commands outside a trusted set.

The pairing matters for audits. A laptop with a tight sandbox and a permissive approval policy behaves very differently from the reverse, and a config file review needs both values. The documentation says that for the Codex CLI and IDE extension, operating-system-level mechanisms enforce the sandbox policy, with defaults of no network access and write permissions limited to the active workspace.

## Three sandbox modes set the file and network boundary

The configuration reference lists sandbox_mode values of read-only, workspace-write and danger-full-access. The default Auto preset pairs workspace-write with on-request approvals. In that preset, per OpenAI's documentation, Codex can read files, edit files and run commands in the working directory automatically, and it asks to edit files outside the workspace or to run commands that need network access. Folders under version control start in that Auto preset. Non-version-controlled folders start read-only, and Codex may also start read-only until the developer explicitly trusts the working directory.

The reference also describes permission profiles through default_permissions, with built-in profiles named :read-only, :workspace and :danger-full-access, and custom profiles defined in [permissions.<name>] tables. The reference says not to combine default_permissions with sandbox_mode.

Approval prompts can be removed. The documentation says --ask-for-approval never, or -a never, disables them, and a --yolo flag is mentioned in the web search guidance. Treat any laptop configuration that sets danger-full-access or never as a finding to review rather than a preference.

## Network is off in workspace-write mode and is opened by one setting

The documentation states that the default workspace-write sandbox keeps network access off unless the developer enables it in configuration. The switch is sandbox_workspace_write.network_access, which can also be passed on the command line with -c. That makes the setting easy to audit: search user and project configuration for it.

Web search is controlled separately from command networking. Codex defaults to a web search cache, an OpenAI-maintained index of results, so cached mode returns pre-indexed results rather than fetching live pages. OpenAI says this reduces exposure to prompt injection from arbitrary live content and that web results should still be treated as untrusted.

Where managed network rules are used, the docs describe destination rules that apply to scripts, programs and subprocesses spawned by commands, and a managed command allowlist for commands that use the managed proxy. OpenAI is clear on one limit: where policy permits full sandbox escalation and the escalation is approved, that execution can bypass the command proxy. Its advice is to configure enforced approval and sandbox requirements for the intended boundary and to test both ordinary and escalated commands. Two proxy options carry dangerous in their names: dangerously_allow_non_loopback_proxy can expose proxy listeners beyond the machine, and dangerously_allow_all_unix_sockets bypasses the Unix socket allowlist.

## Protected paths keep the agent away from repository and credential directories

Inside writable roots, the default workspace-write policy still protects some paths. OpenAI documents that a .git directory (or the resolved directory when .git is a pointer file) is read-only, and so are .agents, .codex and .aws when they exist as directories. The list protects the places an agent could use to change hooks or configuration, or to alter cloud credentials.

OpenAI's page tells teams to choose sandbox, approval and network settings by risk tolerance. The protected-path list names write restrictions. For read access, none found on 12 Nov 2026 in the pages read for this guide: a statement that credential files in a home directory are unreadable. Test what a session can read on your own build before you assume they are out of reach.

## Approvals, Auto-review and MCP tool annotations decide what interrupts the developer

On-request approvals let commands the sandbox allows run without prompting and ask when Codex needs more. Codex can also route eligible approval requests to an automatic reviewer: set approvals_reviewer to auto_review, which applies when approvals are interactive, such as under on-request or a granular approval policy. The documentation's other example value is user. As with any model-based reviewer, treat it as a convenience that reduces prompts, and keep sandbox and network limits as the hard stop.

Codex also elicits approval for app (connector) tool calls that advertise side effects, even when the action is not a shell command or file change. Per the documentation, destructive app or MCP tool calls always require approval when the tool advertises a destructive annotation, unless the tool advertises a read annotation, which takes priority. That rule depends on what the server claims about itself, so an unreviewed MCP server is a trust decision, not a control.

For MCP servers, the configuration reference provides per-server enabled_tools and disabled_tools lists. The disabled list is applied after the enabled list, which makes it a usable deny mechanism for a tool you do not want a server to expose.

## Admin requirements constrain the settings a developer cannot be left to choose

OpenAI's managed configuration documentation separates requirements from defaults. Requirements, set in requirements.toml, constrain security-sensitive settings: approval policy, approvals reviewer, Auto-review policy, sandbox mode, permission profiles, web search mode, managed hooks, which MCP servers users can enable and which plugin marketplace sources they can use. When a developer's value conflicts with an enforced rule, the client applies the rule. Omitted keys remain unconstrained. The older managed_config.toml supplies starting values that users can still change during a run, and the client reapplies them at the next start.

Delivery is through the Agent security area of the admin console, local system requirements or macOS MDM. The precedence rule for local execution is that MDM and legacy managed-device requirements rank above Agent Security, which ranks above the device's system requirements file. OpenAI notes that its cloud-managed requirements do not apply to Work cloud containers, which keep their own policies, so test local and cloud controls separately.

On hooks, the Codex repository's configuration page says admins can set allow_managed_hooks_only = true in requirements.toml to ignore user, project and session hook configurations while still allowing managed hooks. It is supported only in requirements.toml; putting it in config.toml does not enable the mode. The docs also warn that the retired approval policy value untrusted can stop clients from starting, so remove it from old profiles and startup scripts.

## OpenTelemetry export is available, and prompt logging is opt-in

The configuration reference lists an [otel] section with an exporter set to none, otlp-http or otlp-grpc, an endpoint, headers and TLS certificate paths. Raw user prompts are exported only when otel.log_user_prompt is set to true. The reference also describes an analytics.enabled switch for the built-in metrics exporter.

Set the exporter through managed configuration if you want command-level records from every laptop. Verify what your own export contains, command text included, before you rely on it for investigations.

## An endpoint control covers local scope and the approved escalation

Codex's local defaults are tighter than most agents here, and the remaining risk concentrates in three places: a developer who changes the sandbox mode or network setting, an approved escalation outside the sandbox, and MCP servers whose behavior the annotations do not describe. Those are the cases where a second control that records and can stop commands adds something.

Vendors name Codex in their coverage claims. Pillar says its runtime component sits in the pre-tool hook for Claude Code, Codex CLI and Cursor and decides on every action before it runs. CrowdStrike says hooks for OpenAI Codex can inspect prompts and block malicious activity before harmful actions run. Zenity says native hooks and its MCP gateway can block or modify a dangerous Codex tool call before it executes. Cato's AI Endpoint page shows Codex among example local agents with per-user risk flags. These are vendor claims, read on 12 Nov 2026. Check each one against the managed hooks setting above: an endpoint hook that a developer can disable by editing user configuration is a monitoring aid, while one delivered as a managed hook is harder to remove.

## Where this sits in the index

- [Agent Surface Map](/agent-surface-map/): Which of six agent surfaces each of 16 tools sees
- [Action Control Matrix](/action-control-matrix/): Which of six agent actions each tool can stop
- [The ranked index](/ranking/): 16 tools on seven published criteria

## Related guides

- [Securing Google Gemini CLI on developer laptops](/guides/gemini-cli-security/)
- [What coding agents can touch on a developer laptop, and which controls ship with each](/guides/coding-agents-on-developer-laptops/)
- [Securing GitHub Copilot agent mode and the cloud agent](/guides/github-copilot-agent-mode-security/)

## Sources

- OpenAI: Codex docs, agent approvals and security: https://developers.openai.com/codex/agent-approvals-security (read 12 Nov 2026)
- OpenAI: Codex docs, configuration reference: https://developers.openai.com/codex/config-reference (read 12 Nov 2026)
- OpenAI: Codex docs, managed configuration: https://developers.openai.com/codex/enterprise/managed-configuration (read 12 Nov 2026)
- OpenAI: github.com/openai/codex docs/config.md: https://raw.githubusercontent.com/openai/codex/main/docs/config.md (read 12 Nov 2026)
- OpenAI: github.com/openai/codex docs/sandbox.md: https://raw.githubusercontent.com/openai/codex/main/docs/sandbox.md (read 12 Nov 2026)
- Pillar Security: Agentic Endpoint platform page: https://www.pillar.security/platform/agentic-endpoint (read 12 Nov 2026)
- CrowdStrike: Falcon Guardian blog post: https://www.crowdstrike.com/en-us/blog/crowdstrike-advances-ai-security-and-safety-falcon-guardian/ (read 12 Nov 2026)
- Zenity: coding and personal agents use case: https://zenity.io/use-cases/agent-type/coding-personal-agents (read 12 Nov 2026)
- Cato Networks: AI Endpoint platform page: https://www.catonetworks.com/platform/cato-ai-endpoint/ (read 12 Nov 2026)

Last reviewed 12 Nov 2026. Canonical: https://aiendpointsecurityranked.com/guides/codex-cli-security/
