Is Codex safe for company code?

Yes, in its default mode. Codex runs every command in an operating-system sandbox and asks before it writes outside the project or uses the network. The risk starts when a developer turns on full access, or when Codex trusts a repository an attacker wrote.

Certiv brings AI Agent Assurance to Codex: every tool call is checked against company policy before it runs, even with the sandbox off.

In short

Codex security means deciding what OpenAI Codex can reach on a developer’s machine: which files it can write, whether it can use the network, and who approves the rest. This page covers the sandbox modes, full access, the published vulnerabilities, and the controls to require before Codex works on company code.

What Codex can reach in each sandbox mode

Codex enforces its sandbox with Seatbelt on macOS, bubblewrap on Linux and WSL2, and a native sandbox on Windows. The sandbox limits writes and network use, not reads: in every mode Codex can read files such as ~/.aws unless an admin denies those paths.

Is it safe to give Codex full access?

Not on a laptop that holds company credentials. Full access is danger-full-access with the never approval policy, or the --dangerously-bypass-approvals-and-sandbox flag. Nothing stops Codex from deleting files outside the project, sending data out, or pushing to production, and nobody is asked first. Teams turn it on because the default sandbox blocks the network that installs and API calls need. Keep it to disposable containers, and block it in requirements.toml everywhere else. Setting deny_read also makes Codex refuse full access.

Approval prompts wear down the same way: when people approve nearly every one, the prompt stops working as a control, a pattern called approval fatigue.

Three real Codex vulnerabilities, all patched

Each one let something the repository or task controlled reach past the developer’s approval. OpenAI fixed each bug. The pattern remains: Codex acts on input from the code it opens.

  1. Sep 2025

    The sandbox let Codex write outside the project

    CVE-2025-59532 CVSS 4.0: 8.6 · fixed in Codex CLI 0.39.0

    Codex CLI 0.2.0 to 0.38.0 could treat a working directory chosen by the model as the sandbox’s writable root. Codex could then write files and run commands outside the folder the developer started in.

  2. Dec 2025

    Opening a repository ran its MCP servers

    CVE-2025-61260 CVSS 3.1: 9.8 · disclosed by Check Point Research

    Older Codex CLI versions loaded a repository’s .env and .codex/config.toml without asking. An MCP server entry in that config ran as soon as the developer started Codex in the repository.

  3. Mar 2026

    A branch name ran commands in Codex cloud

    BeyondTrust Phantom Labs Rated critical by OpenAI · fixed by January 2026

    Codex cloud passed the branch name into a shell command without sanitizing it. A crafted branch name ran a second command and exposed the GitHub token the task used.

A policy check that stays on when the sandbox is off

Certiv brings AI Agent Assurance to Codex. Certiv Scout runs on each developer machine and checks every tool call Codex makes against company policy before it runs, in every sandbox mode.

Certiv console policy list. Each policy shows a status, Audit, and an intervention. The open menu offers Block, Pause, and Steer.

Product capture. Each policy runs in audit or enforces, with an intervention: Block, Pause, or Steer.

  • Blocks every tool call from a Codex session started with --dangerously-bypass-approvals-and-sandbox.
  • Blocks irreversible deletes such as rm -rf, git push --force, and DROP TABLE, and secrets sent to a remote host.
  • Steers reads of .env, ~/.ssh, and ~/.aws: the read is refused, and Codex is told how to get a setting without printing the secret.
  • Pauses git commit, git merge, Terraform, cloud CLI commands, and production changes until a person approves.

What to require before Codex touches company code

The Codex column is what to set in OpenAI’s admin settings and requirements.toml for every developer. The Certiv column is the policy check Certiv adds on top, which holds in every sandbox mode and every session.

Control In Codex With Certiv
Access
Decide who can use Codex Grant the workspace permissions for local Codex and for Codex cloud only to the groups that need them. Applies policy by group, so each team gets only the Codex access it was approved for.
Keep personal accounts off work machines Set allowed_login_methods = ["chatgpt"] and allowed_chatgpt_workspaces in the local requirements.toml or through MDM. Lists every ChatGPT account Codex signs in with, and blocks the accounts the company has not sanctioned.
Data
Know what leaves the machine Prompts and the code Codex reads go to OpenAI, or to your model gateway if you run one. Retention, training use, and zero data retention follow your OpenAI agreement. history.persistence controls local transcripts. Removes API keys, tokens, and private keys from requests to the model before they leave the machine.
Local runtime
Limit sandbox and approval modes Set allowed_permission_profiles (Codex 0.138.0 and later) or allowed_sandbox_modes, plus allowed_approval_policies, in requirements.toml. Blocks every tool call from a session started with the bypass flag.
Control what a repository can configure A project’s .codex/ config loads only after the project is trusted. An mcp_servers allowlist matches each server by name and identity. Checks each tool call Codex makes in that project against policy before it runs.
Forbid dangerous commands Enforce prefix_rule entries with decision forbidden from requirements.toml. Rules match exact command prefixes. Judges what each command does, so a deletion written with other flags or wrapped in another command still matches.
Keep credentials out of the session List ~/.ssh, ~/.aws, and /**/*.env under deny_read in [permissions.filesystem]. On native Windows it does not cover shell reads. Refuses reads of .env, ~/.ssh, and ~/.aws, and blocks secrets leaving the machine.
Have a person approve high-impact changes Use the on-request approval policy, and prompt rules for commands such as git push. Pauses commits, merges, Terraform, cloud CLI, and production changes for approval, even when Codex asks no one.
Network and supply chain
Restrict network destinations Turn on managed networking ([experimental_network], also read as [network_proxy] from Codex 0.166.0) with domain rules and admin-only allowlists. Limit web search with allowed_web_search_modes. Blocks tunneling tools such as ngrok, and tool calls that send secrets or source code to a remote host.
Review new packages Add prompt rules for install commands such as npm install. Pauses package installs and updates, and new dependencies added to a manifest, for review.
Keep Codex current Update the CLI through your software management. The published vulnerabilities affected older versions. Shows the Codex version on every endpoint, so outdated copies stand out.
Visibility and audit
Know where Codex runs Workspace analytics and the Codex Analytics API report Codex usage. Finds Codex on every endpoint where Certiv Scout runs.
Keep a record for investigations Send Codex logs to your collector with [otel] in requirements.toml. The Compliance API provides audit records. Records each tool call with the policy decision and its reason, by session, across Codex and other agents.
FAQ

Codex security questions

Expand to view common questions.

Is Codex safe to use?
Yes, in its default mode. Codex runs commands in an operating-system sandbox and, in workspace-write mode, asks before it writes outside the project or uses the network. The sandbox limits writes, not reads, so deny reads of credential paths too. Keep Codex CLI current: the published vulnerabilities affected older versions.
Is Codex safe for company code?
It can be, when the limits are set for every developer instead of left to each one. Pin the allowed modes and approval policies in requirements.toml, deny reads of credential paths, allowlist MCP servers, forbid dangerous commands, and collect logs. Then add a policy check that still works when a developer turns the sandbox off.
Is it safe to give Codex full access?
Not on a machine that holds company credentials. Full access is danger-full-access with the never approval policy: no filesystem or network boundary, and nothing asks first. Keep it to disposable containers with no company credentials.
What is danger-full-access?
The Codex sandbox mode that removes the filesystem and network boundaries. The --dangerously-bypass-approvals-and-sandbox flag turns off the sandbox and approvals in one step. Admins can keep developers from selecting it through requirements.toml, with allowed_permission_profiles or, on older deployments, allowed_sandbox_modes.
How do I secure MCP servers in Codex?
Treat MCP entries in a repository’s .codex/config.toml as code, and trust projects deliberately. In requirements.toml, an mcp_servers allowlist enables a server only when its name and identity match an approved entry. CVE-2025-61260 showed the risk in older Codex CLI versions.
How does Certiv work with Codex?
Certiv Scout runs on each developer machine and checks every tool call Codex makes against company policy before it runs, in every sandbox mode. Depending on the policy, the call is allowed and recorded, steered, paused for a person, or blocked. A policy can run in audit first, which records what it would have done without stopping anything.

Let developers use Codex. Keep company policy in charge.

See every Codex tool call checked before it runs, on your own policies.

Book a demo