Codex security: CLI controls and the Codex Security product
Two things share the name. Learn the Codex CLI security controls on your Mac, then how they differ from OpenAI’s Codex Security vulnerability scanner.
“Codex security” can mean two things. The first is how safely the Codex CLI runs on your machine, which depends on its sandbox, approval policy, network setting and what you trust. The second is Codex Security, an OpenAI product that scans application code for vulnerabilities. This page covers the CLI controls first and then separates the product.
The Codex CLI controls
The OpenAI docs describe a layered setup. The sandbox limits what commands can touch, approvals decide when Codex asks you, and network access is off by default.
- Sandbox. Three modes exist,
read-only,workspace-writeanddanger-full-access. On macOS Codex uses Seatbelt. See Codex sandbox. - Approvals. The documented policies are
on-request,neverand a granular policy. The docs say the olderuntrustedpolicy is retired and can stop Codex from starting. - Protected paths. Inside writable roots,
.git,.agents,.codexand.awsstay read-only when they exist. - Network. The agent runs with network access turned off by default.
- Web search. It defaults to
web_search = "cached". The docs say prompt injection can make the agent fetch and follow untrusted instructions, and tell you to treat web results as untrusted. With--yoloor other full-access settings, search defaults to live results. - Credentials.
auth.jsonholds access tokens and should be treated like a password. See Codex API key. - Project trust. Codex loads project
.codex/config, hooks and rules only for trusted projects. See Codex config.toml.
The setting that undoes the rest
--dangerously-bypass-approvals-and-sandbox, with the alias --yolo, removes both the sandbox and the prompts. OpenAI says to use it only in an externally hardened environment. Read the full guide to that flag before using it on a laptop.
What the controls do not cover
A sandbox decides what a command may touch. It does not decide whether a task is a good idea. Several risks sit outside it.
- A folder you added as writable is fully writable.
- A repo you trust can bring its own
.codex/config and hooks. - A push to a shared branch is judged by the Git host. Set branch protection there.
- Text the agent reads, such as a web page, an issue or a file, can carry instructions.
- Session records can contain file contents and command output, so they may hold secrets. See Where Codex keeps session logs.
Codex Security the product
OpenAI’s Codex Security docs say it scans code for vulnerabilities and reports findings with supporting evidence, proposed fixes and tracking of open and fixed findings. The docs list four entry points.
| Entry point | Who it suits, per the docs |
|---|---|
| Daybreak Defense Factory | Teams scanning a GitHub repository and reviewing findings together |
| Codex Security plugin | Individuals scanning a local repository inside Codex |
| Codex Security CLI | Repeatable terminal scans and CI checks |
| Codex Security SDK | Running scans inside an application or developer tool |
The docs point readers to a separate page, Agent approvals and security, for the permissions and sandbox controls that govern Codex itself. Codex Security looks for flaws in your code. The CLI controls limit what the Codex agent can do while it works. They are different tools, and turning on one does not configure the other. The Codex Security docs page does not state which plans include it, so check OpenAI’s page for your plan.
A short checklist for the CLI
- Keep
workspace-writeandon-requestas your default. - Leave network access off unless a task needs it.
- Trust only repos you have read.
- Keep real credentials out of the shell environment.
- Protect shared branches on the Git host.
- Read the session record after any task that mattered.
Checked against the vendor documentation on November 25, 2026. Agent approvals and security · Codex Security · Permissions · Authentication
Read what Codex did
Excellent’s free scan reads supported logs on the Mac and reports findings for review. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code. For a local report without installing an app, run the free scan. See a sample report. Excellent does not scan your code for vulnerabilities. For a wider view, read AI agent security.
Excellent Pro adds checks before supported actions. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Commands sent into an already running Codex shell fall outside that check. Agent coverage · Pricing. Pro is US-only for now.


