Skip to content

OpenAI Codex Sandboxing, Approvals, and Network Access Policy

OpenAI Codex Sandboxing, Approvals, and Network Access Policy

Section titled “OpenAI Codex Sandboxing, Approvals, and Network Access Policy”

Codex is useful because it can read files, edit code, run commands, use tools, and in some desktop workflows interact with applications. Those same abilities create the core security problem. A coding agent that can change files and run commands needs a permission model, not just a friendly prompt.

OpenAI’s Codex security documentation frames the controls around sandboxing and approvals. The practical team policy should translate that into clear rules: what Codex may do freely, what requires approval, what should be blocked, and what should remain human-owned.

Use the narrowest sandbox and approval policy that still lets Codex complete the intended workflow. For most repositories, start with workspace-limited write access and approval for actions that leave the workspace, use the network, access sensitive tools, or perform side effects. Reserve full access for explicitly bounded sessions, not as a default.

TierCodex can doReview posture
Read-only explorationRead project files, explain architecture, propose plansLow risk, good onboarding step
Workspace writeEdit files in the project, run local checksNormal coding-agent mode with diff review
Network-enabled taskInstall packages, fetch docs, call external APIsApproval and source scrutiny required
Tool-connected workflowUse plugins, MCP tools, connectors, browser, appsScope each tool and record evidence
Full accessAct outside normal workspace boundariesRare, time-limited, explicitly justified
Production side effectsDeploy, merge, change secrets, modify billing, delete dataHuman-owned by default

The team should write these tiers down before broad rollout. Otherwise each developer improvises a different risk model.

Sandboxing controls what Codex can technically touch. Approval policy controls when Codex must ask before acting. Tool permissions control which external capabilities are available. Git and review rules control whether output reaches production.

These layers must work together:

  1. Sandbox prevents accidental filesystem and network overreach.
  2. Approval prompts interrupt higher-risk actions.
  3. Tool scopes restrict external systems.
  4. Worktrees isolate parallel changes.
  5. Tests and PR gates verify behavior.
  6. Human review owns merge and deployment.

Removing any layer increases the burden on the others.

Network access is often necessary for:

  • package installation;
  • documentation lookup;
  • dependency updates;
  • API examples;
  • cloud deployment previews;
  • remote MCP servers;
  • connected tools.

Network access is risky because it can:

  • exfiltrate context if misused;
  • pull untrusted code;
  • follow malicious instructions from external content;
  • make tool behavior less reproducible;
  • hide dependency changes inside agent work.

Recommended rule:

Network useDefault
Fetch official docsAllow with task relevance
Install dependenciesApprove and review lockfile
Call production APIsBlock unless explicitly required
Access secretsAvoid direct agent access
Browse arbitrary web pagesAllow only when source quality matters
Download executablesRequire explicit approval and verification

Do not rely on prompt instructions alone to protect secrets. Use environment and tool design:

  • keep secrets out of files Codex does not need;
  • avoid printing secrets in terminal output;
  • use scoped tokens where tools require authentication;
  • prefer read-only tokens for inspection tasks;
  • do not grant deploy credentials to exploratory workflows;
  • rotate credentials if a session exposed them accidentally;
  • keep production admin work human-owned unless a mature approval system exists.

If Codex needs to reason about configuration, give it redacted examples or schema-level documentation where possible.

Plugins and MCP servers should be classified by authority:

Tool classExampleApproval default
Read-only docsInternal docs searchAllow
Read-only project contextGitHub issue readAllow or prompt by repository
Draft outputCreate draft PR summaryAllow with review
Write collaboration toolPost Slack messagePrompt or draft first
Write issue trackerChange label or statusPrompt
Write codeApply patchNormal code review
Deploy or mergeProduction deploymentHuman-owned

Tool outputs should be treated as untrusted context. A web page, issue comment, or document can contain instructions that conflict with the user’s intent. Codex should not treat external text as authority just because a tool returned it.

Automations require stricter defaults because they run unattended.

Minimum rules:

  • test manually before scheduling;
  • use worktrees for recurring write tasks;
  • avoid full access by default;
  • define allowed and forbidden actions in the prompt;
  • require evidence in every run;
  • review early runs;
  • assign an owner;
  • add stop conditions for repeated failures.

If an automation cannot explain what it inspected and why it acted, it should not be making changes.

These should normally require explicit human action outside Codex:

  • merge to protected branches;
  • deploy to production;
  • change DNS;
  • change billing or payment settings;
  • rotate or expose secrets;
  • delete production data;
  • modify access control;
  • approve its own changes;
  • bypass CI;
  • weaken tests to make a build pass.

Codex can prepare evidence or draft commands, but ownership should remain human.

This page is based on OpenAI’s Codex agent approvals and security documentation, Codex sandboxing concept documentation, Codex MCP documentation, Codex plugins documentation, and Codex automations documentation.