In short
- Codex's default for a version-controlled folder is a sandbox that writes only in the workspace, with network access off. Claude Code's sandbox is off until you run
/sandbox. - Claude Code's default guard is auto mode, a classifier that blocks actions it judges unsafe. Codex has a similar reviewer, Auto-review, that you turn on yourself.
- Both vendors publish their flaws. OpenAI issued three Codex CVEs on 1 September 2026, fixed in CLI 0.131.0 and the matching desktop builds; Anthropic lists more than 30 advisories for Claude Code.
- Codex Security and Claude Security scan source code. OpenAI's own FAQ says a scan with no findings "can still miss vulnerabilities".
- Neither tool sees a table left open in a dashboard, a secret behind a
NEXT_PUBLIC_prefix on your host, or account B reading account A's data. Test the deployed app.
On this page
- The short answer
- Claude Code vs Codex: security features side by side
- Sandbox and approvals: two different defaults
- Review and scan tools: what each one reads
- Secrets and cloud runs
- What neither of them checks: the deployed app
- A self-check for an app built with either
- Which settings to change first
- Where Keybrum fits, and where it does not
- Questions
- Sources
The short answer
Claude Code is Anthropic's coding agent. Codex is OpenAI's: a CLI, an IDE extension, the ChatGPT desktop, web and mobile apps, and cloud tasks, included in every ChatGPT plan from Free to Enterprise according to OpenAI's pricing page. Both read your repository, run commands and write code.
Their security models rest on the same two layers: a sandbox that limits what a command can touch, and an approval policy that decides when the agent must ask. The defaults differ. Codex leans on the sandbox first. Claude Code leans on a classifier first. This page compares the two layers, the review tools and the cloud setups, from each vendor's documentation as read on 13 November 2026. It does not rank them on coding quality: we have no data on that, and it is not what leaks your users' data.
For each tool alone, see Claude Code security and Codex security.
Claude Code vs Codex: security features side by side
| Question | Claude Code | Codex |
|---|---|---|
| Who makes it | Anthropic | OpenAI |
| Default on your machine | Auto mode from version 2.1.283: a classifier reviews actions. OS sandbox off | Auto preset in a version-controlled folder: workspace-write sandbox with on-request approvals. Read-only elsewhere |
| OS sandbox | Opt-in with /sandbox. Seatbelt on macOS, bubblewrap on Linux and WSL2. Not on native Windows | On by default. Seatbelt on macOS, bwrap with seccomp on Linux and WSL2, a native sandbox on Windows |
| Network from commands | With the sandbox on: a local proxy with an allowlist that starts empty | Off by default in the CLI, the desktop app and the IDE extension |
| Protected paths | With the sandbox on: .claude settings and shell startup files stay write-denied | .git, .agents and .codex are read-only even inside the workspace |
| Automatic reviewer of risky actions | Auto mode classifier, on by default | Auto-review, set with approvals_reviewer = "auto_review". The default reviewer is you |
| No-guard mode | bypassPermissions | --dangerously-bypass-approvals-and-sandbox, also --yolo |
| Rules the model may miss | CLAUDE.md | AGENTS.md, 32 KiB by default |
| Rules that can block | Deny rules and PreToolUse hooks | .rules files (experimental) and PreToolUse hooks |
| Branch review | /security-review | /review, and the Codex Security plugin for a security scan |
| Pull request review | Code Review, Team and Enterprise | Code review on GitHub, and Security Review on Pro, Business, Edu and Enterprise |
| Cloud runs | One isolated VM per session, GitHub credential kept outside it | One VM per task, network secrets swapped in by a proxy |
| Hosting or database for your app | None | None |
Sandbox and approvals: two different defaults
Codex: the sandbox comes first
Codex has three sandbox modes. read-only lets it inspect files. workspace-write lets it read, edit and run commands in the working directory. danger-full-access removes the filesystem and network limits. The approval policy sits on top: on-request asks when Codex needs to leave the sandbox, never does not ask but still stays inside the sandbox mode.
In a folder under version control, Codex starts in the Auto preset: workspace-write with on-request. In a folder that is not, it starts read-only. Network access is off by default, and commands the agent starts, such as git or a package manager, inherit the same limits. OpenAI warns that turning the network or web search on exposes the agent to prompt injection, and tells you to treat web results as untrusted.
Claude Code: the classifier comes first
Claude Code starts interactive terminal and VS Code sessions in auto mode. A separate classifier model reviews actions and blocks ones such as curl | bash, sending sensitive data to outside endpoints, production deploys, force pushes and mass deletions. Local file operations in the working directory and installs from your lock file are allowed. Anthropic's docs say auto mode "reduces permission prompts but does not guarantee safety".
The OS sandbox is a second layer, and you turn it on with /sandbox. Then shell commands write only to the working directory, a temp directory and folders you added. Reads stay open on most of the machine, including ~/.ssh, until you add deny entries. The sandbox covers shell commands only: file tools, hooks and local MCP servers run outside it. On native Windows, commands run unsandboxed.
Review and scan tools: what each one reads
| Tool | Vendor | What it reads | Availability |
|---|---|---|---|
/security-review | Anthropic | The changes on your current branch, one pass | Built into Claude Code |
| Security-guidance plugin | Anthropic | What Claude writes: each edit, each turn, each commit it makes | All plans |
| Claude Security plugin | Anthropic | A repository or a diff, with verified findings and patches you apply | Paid plan, API access or a cloud provider |
| Code Review | Anthropic | Pull requests | Team and Enterprise |
/review | OpenAI | A branch diff, uncommitted changes or one commit, without changing your files | Codex app, CLI and IDE extension |
| Codex Security plugin | OpenAI | A local repository, read-only, with a report and remediation guidance | Installed from Plugins |
| Security Review | OpenAI | A GitHub pull request's diff and supporting code. Also on demand with @codex security review | Pro, Business, Edu and Enterprise. Not Plus |
| Daybreak Defense Factory | OpenAI | A connected GitHub repository, new commits, scheduled scans | Preview, billed by token usage |
Both vendors describe the limits themselves. OpenAI's FAQ for its cloud scans says that "a scan with no findings can still miss vulnerabilities", and its plugin page says a finding can be validated by source analysis without running a reproducer. Anthropic says scans are nondeterministic, so two scans of the same code can surface different findings, and that its review reads the source code in your checkout, "not a running site or deployed service".
One practical difference: Codex Security Review posts findings on the pull request, where anyone who can view the pull request can read them. OpenAI's docs point this out for public repositories. Think about that before you enable it on an open-source project.
Secrets and cloud runs
On your machine, neither tool hides your .env file by default. In Claude Code you add deny rules such as Read(./.env); its auto mode allows reading .env and sending a credential to its matching API. In Codex, the sandbox limits writes and the network, and OpenAI's sandbox page does not describe a default block on reading files. With both, the working rule is to keep production keys off the machine the agent runs on.
In the cloud, the designs differ in a useful way. Each Claude Code cloud session runs in an isolated VM managed by Anthropic, and your GitHub credential never enters it: a proxy attaches it on Anthropic's side. Each Codex cloud task also runs in a VM. Codex separates environment variables, passed directly to programs, from network secrets: the program gets a placeholder, and a proxy swaps in the real value only for the HTTPS destinations you allowed. If a cloud task needs your Stripe or Supabase key, the network secret is the safer of the two.
What neither of them checks: the deployed app
Neither Claude Code nor Codex hosts your app, runs your database or signs your users in. Both write files, and everything they set up lives in your accounts. So the leaks that reach production are the same with either one, and most are outside what a code scan can see.
- Database policies. A table created by a migration without row level security, or a policy loosened by hand in the Supabase dashboard. Firebase rules edited in the console. No repository file changes, so no scan fires.
- Keys in the bundle. A secret stored on Vercel or Netlify under a
NEXT_PUBLIC_orVITE_name is published in your JavaScript. The repository only holds the variable's name. - Per-user access. A route that checks the session and forgets the owner. A scan can flag the pattern; only two real accounts prove whether B reads A's invoice.
- What is live. An old branch, a preview pointed at production data, source maps, a served
.envfile, a Stripe webhook that accepts unsigned events.
The first item has a number behind it. CVE-2025-48757 was assigned after 170 of 1,645 Lovable apps tested had missing or weak row level security. The cause is a Supabase table without a policy, and a migration written by Claude Code or Codex can produce the same table. See the Supabase RLS guide for the policies and vibe coding security risks for the wider pattern.
A self-check for an app built with either
Four checks, on your own project only.
- 1
Review the branch with the agent you use
In Claude Code, run
/security-review. In Codex, run/reviewagainst your base branch, or ask for a Codex Security scan. Fix what is real. This is the cheap part. - 2
Ask the database, not the code
Run the query below in the Supabase SQL editor. It lists every policy, the role it applies to and its condition. A
qualoftrueon a table with user data means every caller with that role reads every row. - 3
Look at what the browser receives
Open your live site, then the network tab, and search the JavaScript files for
sk_,service_roleandPRIVATE KEY. The frontend API key guide lists which keys are public by design. - 4
Replay requests as someone else
Run the commands below against your own app: once with a second account's cookie, once with none. The IDOR guide explains what each answer means.
select tablename, policyname, roles, cmd, qual
from pg_policies
where schemaname = 'public'
order by tablename, cmd;# Your own app only. As account B, ask for a record that account A created: expect 404.
curl -i https://your-app.example/api/invoices/ID_CREATED_BY_A \
-H "cookie: SESSION_COOKIE_OF_B"
# Signed out: expect 401.
curl -i https://your-app.example/api/invoices/ID_CREATED_BY_A
# Stripe webhook with no signature: expect 400.
curl -i -X POST https://your-app.example/api/webhooks/stripe \
-H "content-type: application/json" -d '{}'Which settings to change first
- Claude Code: run
/sandboxand deny reads of.env,~/.sshand~/.aws/credentials. - Claude Code: keep the workspace trust dialog, and remember that
claude -pshows no trust prompt. - Codex: stay on the Auto preset. Use
--sandbox workspace-writefor scripts, as OpenAI recommends, and leave--yolofor disposable machines. - Codex: leave network access off unless a task needs it, and prefer network secrets over environment variables in cloud environments.
- Both: put your security rules in
CLAUDE.mdorAGENTS.md, then back the ones that must hold with aPreToolUsehook. OpenAI calls its hooks "a useful guardrail, not a complete enforcement boundary". - Both: update. Codex CLI should be at 0.131.0 or later, Claude Code on its current version.
Where Keybrum fits, and where it does not
Keybrum tests neither agent. It has no view of your terminal, your sandbox mode or your approval policy, and it does not replace /security-review or a Codex Security scan. Those read code before a merge. Keybrum attacks the app after the deploy, and only when its owner has proved ownership.
It works from the outside, the way a stranger would. It lists the Supabase tables your public key can reach and reads them with no account, then as a new account. It collects every API route your JavaScript calls and calls each one with no session. It creates a marked record as one account and requests it as another. It checks whether keys found in the bundle or in API answers work, sends one unsigned event to the Stripe webhook, posts a short prompt to AI routes with no session, and requests /.env and source maps. It also proves Next.js flaws such as the middleware bypass by behaviour. A finding always carries the request that worked.
Claude Code and Codex both speak MCP, so either can read the findings and the fixes from Keybrum's MCP server (setup), apply them and ask for a retest. A one-time report costs €49 for one app. Plans start at €29 a month excluding VAT for 5 apps, and attack again on every deploy.
Questions
Is Codex safer than Claude Code?
Out of the box, Codex restricts more on your machine: a sandbox with the network off in any version-controlled folder. Claude Code's default is a classifier, and its sandbox is opt-in. Once you turn Claude Code's sandbox on, the two are close. Both have published sandbox or approval bypasses, so neither default is a promise.
Does Codex have a command like /security-review?
Codex has /review for a general review of a branch, uncommitted changes or a commit. For security specifically, OpenAI ships Codex Security: a plugin that scans a local repository, a CLI for CI, and Security Review on GitHub pull requests, which you can request with @codex security review.
Does either tool test my live app?
No. Both review and scan source code. Anthropic says its review reads your checkout, not a running site or deployed service, and OpenAI's Codex Security pages describe scans of repositories, commits and pull requests. Policies set in a dashboard and behaviour across two accounts need a test of the running app.
Which plans include Codex?
OpenAI's pricing page says Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise. It can also run in the CLI, SDK or IDE extension with an API key, billed at API prices and without cloud features such as GitHub code review.
Can a malicious repository attack me through these agents?
It has happened with both. Codex's CVE-2026-19592 let a prepared repository run a program through Git's core.fsmonitor setting without a prompt, and Claude Code's CVE-2026-33068 let a committed settings file skip the trust dialog. Both are fixed. Keep the tool updated and read a repository's agent configuration before opening it.
Do AGENTS.md and CLAUDE.md enforce security rules?
No. Both are instructions the model reads, and a model can miss an instruction on a long task. Anthropic says CLAUDE.md is context, and points to hooks when an action must be blocked. Use the file for rules and a hook or a CI check for the ones that must never break.
Sources
- 1.Agent approvals and security, OpenAI
- 2.Sandboxing, OpenAI
- 3.Codex Security, OpenAI
- 4.Codex Security Review, OpenAI
- 5.Daybreak Defense Factory FAQ, OpenAI
- 6.Code review, OpenAI
- 7.Cloud environments, OpenAI
- 8.Hooks, OpenAI
- 9.Pricing, OpenAI
- 10.CVE-2025-59532, CVE Program
- 11.CVE-2026-19591, CVE Program
- 12.CVE-2026-19592, CVE Program
- 13.Security, Anthropic
- 14.Choose a permission mode, Anthropic
- 15.Sandboxing, Anthropic
- 16.Catch security issues as Claude writes code, Anthropic
- 17.Scan your codebase for vulnerabilities, Anthropic
- 18.Security advisories for anthropics/claude-code, GitHub
- 19.CVE-2026-33068, CVE Program
- 20.CVE-2025-48757, NVD