In short
- Codex starts in the Auto preset in a version-controlled folder: a
workspace-writesandbox withon-requestapprovals and no network. Outside version control it starts read-only. --yoloremoves both the sandbox and the approvals. OpenAI labels it elevated risk and not recommended.- Codex Security is a real product with four forms: a plugin, a CLI, an SDK and Daybreak Defense Factory in the cloud. Security Review on pull requests is for Pro, Business, Edu and Enterprise.
- OpenAI has published four Codex CVEs with fixes. The three from 1 September 2026 are fixed in Codex CLI 0.131.0 and the matching desktop builds.
- Every Codex Security scan reads source code. OpenAI says a scan with no findings can still miss vulnerabilities, and nothing in it sends a request to your live app.
On this page
- Two meanings of "Codex security"
- The Codex sandbox and approval modes
- Known Codex vulnerabilities, and what they teach
- Codex Security: the scanner OpenAI ships
- What Codex and Codex Security do not check on the deployed app
- How to check an app Codex built
- Fixes, with rules for AGENTS.md
- What Keybrum tests here, and what it does not
- Questions
- Sources
Two meanings of "Codex security"
Codex is OpenAI's coding agent. Today it runs as the Codex CLI, an IDE extension, inside the ChatGPT desktop, web and mobile apps, and as cloud tasks. OpenAI's pricing page lists it in every ChatGPT plan, from Free to Enterprise, and it also runs with an API key in the CLI, the SDK and the IDE extension.
People who search for Codex security want one of two things. Some ask whether the agent is safe to run: what it can touch on their machine, and what a hostile repository can make it do. Others look for Codex Security, the scanner OpenAI ships to find vulnerabilities in code. This page covers both, from OpenAI's documentation as read on 13 November 2026, then the part neither covers: the app you deployed.
| Area | What OpenAI handles | What you handle |
|---|---|---|
| What the agent may do locally | The sandbox, approval policies, protected paths, Auto-review | Which mode you pick, your rules, what you approve |
| Flaws in Codex itself | Fixes and public CVE records | Running a fixed version |
| Cloud tasks | One VM per task, a proxy for network secrets, internet access settings | Which repositories, domains and secrets you connect |
| Vulnerabilities in your code | Codex Security scans, /review, Security Review on pull requests | Running them, reading the findings, fixing what is real |
| Your app's database, auth, keys and hosting | Nothing: Codex does not run them | All of it |
The Codex sandbox and approval modes
Two settings decide what Codex does without you. The sandbox mode is a technical limit on files and network. The approval policy decides when Codex must stop and ask.
| Setting | Value | What it means |
|---|---|---|
| Sandbox mode | read-only | Codex can inspect files. Edits and commands outside that need approval |
| Sandbox mode | workspace-write | Codex reads, edits and runs commands in the working directory. It asks before editing outside it or using the network |
| Sandbox mode | danger-full-access | No filesystem or network limit |
| Approval policy | on-request | Commands the sandbox allows run alone. Codex asks when it needs to leave the sandbox |
| Approval policy | never | Codex never asks, and still stays inside the sandbox mode |
| Reviewer | user (default) or auto_review | Who answers approval requests: you, or a separate reviewer agent |
The defaults are careful. In a folder under version control, Codex starts in the Auto preset, workspace-write with on-request. In any other folder it starts read-only. Network access is off by default in the CLI, the desktop app and the IDE extension, and web search uses a cached index maintained by OpenAI instead of live pages. Inside the workspace, .git, .agents and .codex stay read-only, so the agent cannot rewrite its own configuration or your Git hooks.
The sandbox is enforced by the operating system: Seatbelt on macOS, bwrap with seccomp on Linux and WSL2, and a native sandbox on Windows. Commands the agent starts, such as git, a package manager or a test runner, inherit the same limits.
Auto-review, rules and hooks
Auto-review sends approval requests to a separate reviewer agent instead of you. It is designed to block sending secrets to untrusted destinations, probing for credentials, weakening security settings and destructive actions. OpenAI says it "is not a deterministic security guarantee" and should complement the sandbox. Rules are .rules files that allow, prompt or forbid command prefixes outside the sandbox; OpenAI marks them experimental. Hooks run your scripts in the agent loop, and a PreToolUse hook can deny a tool call. OpenAI's wording: "a useful guardrail, not a complete enforcement boundary".
Known Codex vulnerabilities, and what they teach
OpenAI publishes CVE records for Codex. Four are worth knowing, because they show where an agent's protections tend to fail: at the edge between the sandbox and the tools around it.
| CVE | What happened | Fixed in |
|---|---|---|
| CVE-2025-59532 | Codex CLI could treat a path chosen by the model as the sandbox's writable root, which allowed writes outside the folder where the session started. CVSS 8.6 | CLI 0.39.0 |
| CVE-2026-19591 | A parsing difference made some PowerShell commands look safe, so instructions in a prepared repository could run a file-writing Git command with no approval | CLI 0.131.0 and matching desktop builds |
| CVE-2026-19592 | A repository delivered with its .git/config intact could set core.fsmonitor and get a program run outside the sandbox while Codex collected Git metadata | CLI 0.131.0 and matching desktop builds |
| CVE-2026-19593 | Opening a workspace in Codex Desktop could run a Git filter program set in a prepared .git/config, with no prompt | Desktop 26.519 builds |
The CVE records for the last two note a limit that matters: an ordinary git clone does not copy the source repository's .git/config, so the attack needs a repository delivered as an archive or a copied folder. A fifth record, CVE-2025-61260, describes Codex CLI 0.23.0 and earlier loading a project's .env and .codex/config.toml without confirmation. The practical rules follow from all five: update Codex, clone repositories instead of unpacking archives from strangers, and read a project's .codex/ folder before you open it.
Codex Security: the scanner OpenAI ships
Codex Security "reviews code for vulnerabilities and reports evidence you can use to investigate and fix them". It comes in four forms, plus a pull request review.
| Form | What it does | Notes |
|---|---|---|
| Codex Security plugin | A read-only scan of a local repository inside Codex, with a report.md, findings and remediation guidance | Install from Plugins, then ask: "Run a Codex Security scan on this repository." |
| Codex Security CLI | The same scan from a terminal or CI: npm install -g @openai/codex-security | It runs with your operating-system permissions and does not pause for approval. Findings do not fail a CI check unless you set a severity policy |
| Codex Security SDK | Scans and results inside your own tool | For teams that build on it |
| Daybreak Defense Factory | Cloud scans of a connected GitHub repository, monitoring of new commits, scheduled scans, proposed patches and draft pull requests | Preview. Billed by token usage, outside the plan's included allowance |
| Security Review | A security review of each GitHub pull request, or on demand with @codex security review | Pro, Business, Edu and Enterprise. Not Plus |
It is worth using. A scan builds a threat model of the repository, which you can edit to add deployment facts, and reports each finding with its attack path and evidence. Automatic pull request reviews report High and Critical findings by default; manual ones add Medium. You can import findings from Snyk, Endor Labs or Wiz into Daybreak to triage them in one place.
OpenAI is direct about the limits. Results depend on how well the model reasons about your language and framework. "A scan with no findings can still miss vulnerabilities." A finding can rest on source analysis without a reproducer being run. A proposed patch or a status change does not verify a fix. And Security Review posts its findings on the pull request, where anyone who can view the pull request reads them: think twice on a public repository.
What Codex and Codex Security do not check on the deployed app
Codex has no hosting, no database and no auth service. It writes files, and whatever it sets up in Supabase, Firebase, Vercel or Stripe lives in your accounts. Codex Security scans application code. That leaves a set of leaks that are not in the code, or that code alone cannot prove.
| Leak | Where it lives | Why a repository scan misses it |
|---|---|---|
| A table anyone can read | Supabase or Firebase: row level security off, or rules set in the console | The setting is in the provider's dashboard. No file changes |
| A secret key in the browser | A variable named NEXT_PUBLIC_ or VITE_ on your host, or a route that returns a key | The repository holds the variable's name, the host holds its value |
| Account B reads account A's data | An API route or a policy that checks the session and forgets the owner | A scan can flag the pattern. Proof needs two real accounts on the running app |
| An AI route anyone can call | A chat or generate route without a session check or a limit | Missing rate limits are easy to miss in a review of one diff |
| Files that should not be served | /.env, /.git, source maps, on the live host | They depend on the build and the host's configuration |
The first row is the best documented. CVE-2025-48757 followed a test of 1,645 apps built with Lovable: 170, about one in ten, had missing or weak row level security. Nothing in that bug is specific to one builder. A migration Codex writes with create table and no policy produces the same open table. The Supabase RLS guide and the Supabase service role key guide cover the two most costly mistakes.
How to check an app Codex built
Do these on your own project only. The first two happen in Codex, the others on the database and the live site.
- 1
Confirm how Codex is running
Run
codex --versionand compare it with 0.131.0. In the CLI, type/permissionsand check that you are on the Auto preset, with the network off unless a task needs it. - 2
Scan the repository
Type
/reviewfor a review of your branch against its base, then ask for a Codex Security scan. Read the report's coverage section: OpenAI notes that a completed scan can still have gaps and lists deferred areas. - 3
List tables without row level security
Run the SQL below in the Supabase SQL editor. Every table it returns is readable with the public key unless a policy restricts it. The RLS checker reviews the policies line by line.
- 4
Search the build for secret keys
Build the app and run the
grepbelow. For anything it finds, follow what to do when an API key leaks: rotate first, then fix the code. - 5
Test as a second account and signed out
Create accounts A and B. As A, create a record and copy its request from the network tab. Replay it with B's session, then with none. Expect a 404 and a 401. The IDOR guide explains the fix.
select schemaname, tablename
from pg_tables
where schemaname = 'public'
and rowsecurity = false
order by tablename;codex --version
npm run build
grep -rlE "sk_live_|rk_live_|sk-proj-|sk-ant-|sb_secret_|PRIVATE KEY-----" .next/static dist build 2>/dev/null
# Your own app only. Expect a 404 page, never file contents.
curl -s https://your-app.example/.env | head -n 5Fixes, with rules for AGENTS.md
Codex reads AGENTS.md before it works: a global one in ~/.codex, then one per directory from the repository root down, up to 32 KiB in total by default. Put your security rules there so every session starts with them. It is guidance the model reads, so keep the checks above as well.
## Security rules
- Every new database table enables row level security in the same
migration, with policies that compare the owner column to auth.uid().
- Never put a secret key in a NEXT_PUBLIC_ or VITE_ variable. Secret keys
are read in server code only.
- Every API route and server action takes the user from the session and
checks that the record belongs to that user.
- Create and update handlers ignore role, plan and credit fields sent by
the client.
- Routes that call an AI model require a session and a per-user limit.
- Stripe webhooks verify the signature on the raw body.
- Ask before adding a dependency, and give the exact package name.When you ask Codex to fix a finding, name the class of bug and ask for a list before the change. For example: "List every API route and server action. For each, say how it gets the current user and whether it checks that the record belongs to that user. Fix the ones that do not." The vibe coding security checklist has the full list by layer, and the Stripe webhook guide has the signature check.
What Keybrum tests here, and what it does not
Keybrum does not test Codex. It cannot see your sandbox mode, your approval policy or your Codex version, and it does not scan a repository the way Codex Security does. If your question is whether the agent is safe on your machine, the sections above are the answer, and OpenAI's documentation is the reference.
Keybrum tests the result: the deployed app, when its owner has proved ownership. It reads Supabase tables and Firestore collections with no account and then as a new account. It calls each API route your JavaScript names with no session. It creates a marked record as one identity and requests it as a second one, then tries one reversible change to it. It checks whether keys found in the bundle work, posts a short prompt to AI routes without a session, sends one unsigned event to the Stripe webhook, and requests /.env, /.git and source maps. Every finding comes with the request that worked.
Codex supports MCP, so it can read each finding and its fix from Keybrum's MCP server (setup), apply the change and ask for a retest. A one-time report is €49 for one app, with retests for 7 days. Plans start at €29 a month excluding VAT for 5 apps and attack again on every deploy.
Questions
Is OpenAI Codex safe to use?
Its defaults are cautious: in a version-controlled folder it works in a sandbox limited to the workspace, with network access off, and asks before going further. OpenAI has fixed several sandbox and approval bypasses, so run a current version and avoid --yolo outside disposable machines. The app Codex writes is a separate question, and yours to test.
What is Codex Security?
It is OpenAI's vulnerability scanner for code. It exists as a plugin inside Codex, a standalone CLI, an SDK and a cloud product called Daybreak Defense Factory, in preview, that scans connected GitHub repositories and monitors new commits. It reports findings with evidence and can propose patches.
Which plans include Codex Security Review?
OpenAI's documentation says Security Review on GitHub pull requests is available to ChatGPT Pro, Business, Edu and Enterprise customers, and not to Plus. Reviews use your included Codex allowance or ChatGPT credits. Cloud repository scans in Daybreak are billed separately, by token usage.
Does Codex Security test my running app?
OpenAI's pages describe scans of repositories, commits, pull requests and local diffs. Findings can include a reproducer or a test, and OpenAI notes that source-based findings do not always include a runtime reproduction. Nothing in the documentation describes requests sent to your production site.
Does the Codex sandbox work on Windows?
Yes. OpenAI documents a native Windows sandbox, and WSL2 uses the Linux implementation with bwrap. WSL1 is no longer supported from Codex 0.115.
Can Codex read my .env file?
OpenAI's sandbox documentation describes limits on writes and on the network, and does not describe a default block on reading files in your project. Assume Codex can read what your user can read there. Keep production keys off the machine, and in cloud environments use network secrets, which give the program a placeholder instead of the value.
Is Codex cloud safer than Codex on my laptop?
It is isolated in a different way. Each cloud task runs in its own VM with only the repositories you selected, and internet access is a setting per environment. Your laptop's files are out of reach, but any secret you pass as an environment variable is readable by programs in the task.
Sources
- 1.Agent approvals and security, OpenAI
- 2.Sandboxing, OpenAI
- 3.Auto-review, OpenAI
- 4.Codex Security, OpenAI
- 5.Codex Security plugin, OpenAI
- 6.Codex Security CLI, OpenAI
- 7.Codex Security Review, OpenAI
- 8.Daybreak Defense Factory setup, OpenAI
- 9.Daybreak Defense Factory FAQ, OpenAI
- 10.Cloud environments, OpenAI
- 11.Rules, OpenAI
- 12.Hooks, OpenAI
- 13.AGENTS.md, OpenAI
- 14.Pricing, OpenAI
- 15.CVE-2025-59532, CVE Program
- 16.CVE-2026-19591, CVE Program
- 17.CVE-2026-19592, CVE Program
- 18.CVE-2026-19593, CVE Program
- 19.CVE-2025-61260, CVE Program
- 20.Security advisories for openai/codex, GitHub
- 21.CVE-2025-48757, NVD