Codex security: the sandbox, Codex Security scans, and what stays yours

Codex security means two things. The agent is sandboxed by default: in a version-controlled folder it writes only in the workspace, with network access off, and asks before going further. Codex Security is OpenAI's scanner, which reviews repositories and pull requests for vulnerabilities. Both work on code. Neither tests the app you deployed, where open tables, leaked keys and missing owner checks show.

The team behind Keybrum's attacksUpdated 12 min read

In short

  • Codex starts in the Auto preset in a version-controlled folder: a workspace-write sandbox with on-request approvals and no network. Outside version control it starts read-only.
  • --yolo removes 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"

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.

AreaWhat OpenAI handlesWhat you handle
What the agent may do locallyThe sandbox, approval policies, protected paths, Auto-reviewWhich mode you pick, your rules, what you approve
Flaws in Codex itselfFixes and public CVE recordsRunning a fixed version
Cloud tasksOne VM per task, a proxy for network secrets, internet access settingsWhich repositories, domains and secrets you connect
Vulnerabilities in your codeCodex Security scans, /review, Security Review on pull requestsRunning them, reading the findings, fixing what is real
Your app's database, auth, keys and hostingNothing: Codex does not run themAll 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.

SettingValueWhat it means
Sandbox moderead-onlyCodex can inspect files. Edits and commands outside that need approval
Sandbox modeworkspace-writeCodex reads, edits and runs commands in the working directory. It asks before editing outside it or using the network
Sandbox modedanger-full-accessNo filesystem or network limit
Approval policyon-requestCommands the sandbox allows run alone. Codex asks when it needs to leave the sandbox
Approval policyneverCodex never asks, and still stays inside the sandbox mode
Revieweruser (default) or auto_reviewWho 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.

CVEWhat happenedFixed in
CVE-2025-59532Codex 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.6CLI 0.39.0
CVE-2026-19591A parsing difference made some PowerShell commands look safe, so instructions in a prepared repository could run a file-writing Git command with no approvalCLI 0.131.0 and matching desktop builds
CVE-2026-19592A repository delivered with its .git/config intact could set core.fsmonitor and get a program run outside the sandbox while Codex collected Git metadataCLI 0.131.0 and matching desktop builds
CVE-2026-19593Opening a workspace in Codex Desktop could run a Git filter program set in a prepared .git/config, with no promptDesktop 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.

FormWhat it doesNotes
Codex Security pluginA read-only scan of a local repository inside Codex, with a report.md, findings and remediation guidanceInstall from Plugins, then ask: "Run a Codex Security scan on this repository."
Codex Security CLIThe same scan from a terminal or CI: npm install -g @openai/codex-securityIt 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 SDKScans and results inside your own toolFor teams that build on it
Daybreak Defense FactoryCloud scans of a connected GitHub repository, monitoring of new commits, scheduled scans, proposed patches and draft pull requestsPreview. Billed by token usage, outside the plan's included allowance
Security ReviewA security review of each GitHub pull request, or on demand with @codex security reviewPro, 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.

LeakWhere it livesWhy a repository scan misses it
A table anyone can readSupabase or Firebase: row level security off, or rules set in the consoleThe setting is in the provider's dashboard. No file changes
A secret key in the browserA variable named NEXT_PUBLIC_ or VITE_ on your host, or a route that returns a keyThe repository holds the variable's name, the host holds its value
Account B reads account A's dataAn API route or a policy that checks the session and forgets the ownerA scan can flag the pattern. Proof needs two real accounts on the running app
An AI route anyone can callA chat or generate route without a session check or a limitMissing 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 hostThey 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. 1

    Confirm how Codex is running

    Run codex --version and compare it with 0.131.0. In the CLI, type /permissions and check that you are on the Auto preset, with the network off unless a task needs it.

  2. 2

    Scan the repository

    Type /review for 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. 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. 4

    Search the build for secret keys

    Build the app and run the grep below. For anything it finds, follow what to do when an API key leaks: rotate first, then fix the code.

  5. 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.

sql
select schemaname, tablename
from pg_tables
where schemaname = 'public'
  and rowsecurity = false
order by tablename;
bash
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 5

Fixes, 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.

markdown
## 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.
AGENTS.md

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. 1.Agent approvals and security, OpenAI
  2. 2.Sandboxing, OpenAI
  3. 3.Auto-review, OpenAI
  4. 4.Codex Security, OpenAI
  5. 5.Codex Security plugin, OpenAI
  6. 6.Codex Security CLI, OpenAI
  7. 7.Codex Security Review, OpenAI
  8. 8.Daybreak Defense Factory setup, OpenAI
  9. 9.Daybreak Defense Factory FAQ, OpenAI
  10. 10.Cloud environments, OpenAI
  11. 11.Rules, OpenAI
  12. 12.Hooks, OpenAI
  13. 13.AGENTS.md, OpenAI
  14. 14.Pricing, OpenAI
  15. 15.CVE-2025-59532, CVE Program
  16. 16.CVE-2026-19591, CVE Program
  17. 17.CVE-2026-19592, CVE Program
  18. 18.CVE-2026-19593, CVE Program
  19. 19.CVE-2025-61260, CVE Program
  20. 20.Security advisories for openai/codex, GitHub
  21. 21.CVE-2025-48757, NVD

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub