Skip to content

Codex vs Cursor: sandbox, approvals and security compared

OpenAI's Codex and Cursor side by side on sandboxing, approval and run modes, network access, hooks, admin policy and public advisories, with a source for every fact.

Checked

Codex

Made by
OpenAI
Out of the box
In a version-controlled folder it starts in the Auto preset: workspace-write sandbox with on-request approvals, so sandboxed commands run and leaving the sandbox asks. Folders without version control start read-only.
Sandbox
Yes, on by default. macOS uses Seatbelt through sandbox-exec, Linux uses bwrap and seccomp, Windows has its own sandbox. It covers spawned commands, and .git, .agents, .codex and .aws stay read-only inside writable roots.
Public advisories
1 with a CVE or GHSA id, 1 rated critical or high

Cursor

Made by
Cursor, now part of Grok Build (SpaceX)
Out of the box
Auto-review is the recommended mode. Allowlisted calls run, other shell commands run in the sandbox when possible, and the rest go to an LLM classifier. The security page says terminal commands and all MCP tools need approval by default.
Sandbox
Yes, for terminal commands in Auto-review and optionally in Allowlist mode. macOS uses Seatbelt through sandbox-exec. Run Everything has no sandbox. Commands that need more access leave the sandbox after a prompt or classifier review. Docs say it is not a hard security boundary.
Public advisories
8 with a CVE or GHSA id, 8 rated critical or high

Short answer

Codex and Cursor both run agent commands in a Seatbelt sandbox on macOS with no network by default, so their safe defaults are closer than most pairs. They differ in who decides when a command leaves the sandbox. Codex asks you. Cursor's Auto-review mode can let an AI classifier decide, or ask you. Codex is an open source CLI with an IDE extension and a desktop app, for OpenAI models. Cursor is an editor with models from several providers, and on November 30, 2026 it became the desktop app of Grok Build.

At a glance

Every answer links to the page that says it. Both agents change often, so their own docs win where they differ from this page.

Safety controls, side by side
QuestionCodexCursor
Sandbox on from the first runYesworkspace-write in a repo, read-only elsewhere26YesIn Auto-review, the recommended mode17
OS-level sandbox availableYesSeatbelt on macOS, bwrap and seccomp on Linux26YesSeatbelt on macOS, Landlock or Bubblewrap on Linux17
No network in commands by defaultYesOff until network_access = true234YesBlocked in the sandbox until a host list opens it17
Asks you before shell commands by defaultPartlySandboxed commands run; leaving the sandbox asks2PartlyA classifier decides what leaves the sandbox17
Deny rules you writePartlyAdmin command rules can prompt or forbid27NoAllowlists only in the editor13
A hook can block a tool callYesPreToolUse can deny10YesSix permission hooks can deny2
Admin policy users cannot overrideYesrequirements.toml, also by MDM7YesEnterprise dashboard and MDM12456
Admins can turn off the skip-approvals modeYesrequirements.toml enforces approval and sandbox modes24YesThe dashboard enforces run modes13
Open sourceYesApache-2.0 CLI8NoNo source license stated

The basics

QuestionCodexCursor
Runs in
Terminal CLI, IDE extension and desktop app (macOS and Windows) share one config.toml. Codex cloud is a separate surface that runs tasks on OpenAI's side.496
Desktop app with an editor and an Agents Window, the legacy cursor-agent terminal CLI, Cloud Agents, Slack, GitHub and iOS. The separate Grok Build terminal UI (grok) is a different product and is not covered here.15101314
Platforms
CLI sandbox on macOS, Linux and Windows (WSL2 uses the Linux sandbox). The desktop app launches on macOS or Windows.24
macOS, Linux and Windows for the desktop app. The sandbox uses Seatbelt on macOS and Landlock or Bubblewrap on Linux. The docs list no Windows sandbox.1213
Open source
Yes, Apache-2.0 (the CLI, in the openai/codex repository). Latest release at verification: rust-v0.173.0.8
Not documented as open source. The docs reviewed state no source license for the app or the cursor-agent CLI.
Models
OpenAI models. The 0.171.0 changelog entry adds GPT-6.2 Sol and Astra to the catalogs, with Sol as the default selection. You set model in config.toml.59
Several providers through one picker: Grok 4.7, GPT-5.6 Sol, Claude Fable 5.2 and Opus 5.5, Gemini 3.1 Pro, Composer 2.5, plus an Auto router.13
Pricing
Included in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise plans. Plus is $20 a month. You can also use an API key and pay API rates, without the cloud features.1
Legacy plans: Hobby free, Pro $20 a month, Pro+ $60, Ultra $200, Teams $40 or $120 a seat. Newer plans are sold through The X Subscription, from free to $200 a month.12

Safety controls

QuestionCodexCursor
Out of the box
In a version-controlled folder it starts in the Auto preset: workspace-write sandbox with on-request approvals, so sandboxed commands run and leaving the sandbox asks. Folders without version control start read-only.2
Auto-review is the recommended mode. Allowlisted calls run, other shell commands run in the sandbox when possible, and the rest go to an LLM classifier. The security page says terminal commands and all MCP tools need approval by default.17
Sandbox
Yes, on by default. macOS uses Seatbelt through sandbox-exec, Linux uses bwrap and seccomp, Windows has its own sandbox. It covers spawned commands, and .git, .agents, .codex and .aws stay read-only inside writable roots.26
Yes, for terminal commands in Auto-review and optionally in Allowlist mode. macOS uses Seatbelt through sandbox-exec. Run Everything has no sandbox. Commands that need more access leave the sandbox after a prompt or classifier review. Docs say it is not a hard security boundary.17
Network in commands
Off by default in the sandbox. You turn it on with network_access = true under [sandbox_workspace_write]. Domain rules apply only when the network_proxy feature is on. Web search defaults to cached results.234
Blocked in the sandbox by default, then opened by the network mode. The default mode is sandbox.json plus a built-in list of package and git hosts. Agents without a sandbox cannot make arbitrary requests by default.17
Turning approvals off
--dangerously-bypass-approvals-and-sandbox, alias --yolo, runs every command with no approvals and no sandbox. The docs mark it not recommended. --ask-for-approval never turns prompts off but keeps the sandbox.24
Run Everything mode in Settings runs every tool call with no sandbox and no classifier. A --force flag for cursor-agent is reported by third parties but not in the docs read. The grok TUI has --always-approve.13
Permission rules
Execution-policy rules decide which commands run without approval, and a rule can also require review. Admins can add command rules in requirements.toml that can only prompt or forbid. The rules file syntax is Not documented on pages checked today.27
~/.cursor/permissions.json and .cursor/permissions.json hold a terminalAllowlist, an mcpAllowlist and plain English autoRun instructions. No deny syntax is documented for the editor. The legacy CLI reads permissions.allow in cli-config.json.13
Hooks before a tool runs
Yes, on by default. PreToolUse can deny a call (permissionDecision: "deny" or exit code 2) or rewrite its input. It covers shell, apply_patch and MCP tools, not hosted tools such as web search. The docs call hooks a guardrail, not a complete boundary.10
Yes. 21 events in hooks.json. Six permission events, including beforeShellExecution, beforeMCPExecution and preToolUse, can allow or deny. Exit code 2 blocks. Other failures fail open unless failClosed is true.2
Project instructions
AGENTS.md. Codex reads ~/.codex/AGENTS.override.md or AGENTS.md, then one file per directory from the project root down. Combined size is capped at 32 KiB by default. Fallback names are configurable.11
.cursor/rules/*.mdc (with frontmatter) and AGENTS.md in the project root and subfolders. User and team rules are set in the app and the dashboard. CLAUDE.md is not listed on the rules page.8
MCP servers
Yes. Servers are [mcp_servers.<name>] tables in ~/.codex/config.toml or a trusted project's .codex/config.toml, over stdio or streamable HTTP. codex mcp add manages them.12
Yes. Servers go in .cursor/mcp.json or ~/.cursor/mcp.json, over stdio, SSE or streamable HTTP. Every MCP tool call needs approval by default unless it is on an allowlist. Enterprise admins can restrict which servers run.479
Session history
Local state lives under CODEX_HOME, default ~/.codex. The docs name history.jsonl there. Session files exist at ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl, but the docs checked today do not describe that folder.13
Local transcript paths are not documented in the docs read. Project folders sit under ~/.cursor/projects. Enterprise admins get audit logs streamed to a SIEM, webhook or S3, plus OpenTelemetry export.156
Admin policy
requirements.toml at /etc/codex/requirements.toml (macOS and Linux) or via macOS MDM domain com.openai.codex, key requirements_toml_base64. Cloud requirements also exist. Users cannot override them. Plans that get cloud requirements: Not documented.7
Enterprise: team dashboard settings for run modes, sandbox network rules, MCP allowlists and Privacy Mode override user and project config. MDM can push permissions.json and /Library/Application Support/Cursor/hooks.json.12456

The differences that matter

Leaving the sandbox

With Codex's Auto preset, commands run in the sandbox and you are asked when one needs to leave it. In Cursor's Auto-review mode, allowlisted calls run, other shell commands run in the sandbox where they can, and the rest go to an AI classifier or a prompt. Cursor's docs say Auto-review is not a security boundary.

Turning it off

Codex's --yolo removes the sandbox and the approvals together, and --ask-for-approval never drops only the prompts. Cursor's Run Everything mode, set in Settings, turns off both the sandbox and the classifier.

Protected paths

Inside its writable folders Codex keeps .git, .codex, .agents and .aws read-only. Cursor's sandbox write-protects .git/hooks, .git/config, .vscode and .cursorignore. Cursor allows reads outside the workspace by default.

Hooks and admin policy

Both have a hook that runs before a tool call and can deny it. Cursor's fail open on a crash unless failClosed is set, and Codex's docs call hooks a guardrail. Codex admins enforce settings with requirements.toml, pushed by file or MDM. Cursor's Enterprise dashboard enforces run modes, network rules and MCP allowlists, with audit logs to a SIEM.

Cursor is now part of Grok Build

Cursor joined SpaceX in August 2026 and became the Grok Build desktop app on November 30. Its docs moved to docs.grok.com, and new plans are sold through The X Subscription.

Public advisories

Codex's repository lists one advisory, from September 2025, fixed in CLI 0.39.0. Cursor's lists eight from November 2025 to July 2026, two rated critical, most of them sandbox escapes through paths, symlinks and Git hooks. Cursor's sandbox has had more researchers testing it, and keeping it updated matters.

Approval modes

Each agent's modes, from the one that asks most to the one that asks least, with the mode each starts in marked.

Codex

  1. read-onlyAsks for some actions
  2. workspace-write with on-request (Auto)Asks for some actionsStarts here
  3. granular approvalsAsks for some actions
  4. neverNever asks
  5. danger-full-accessAsks for some actions
  6. yoloNever asks

Cursor

  1. AllowlistAsks before each action
  2. Auto-reviewAsks for some actionsStarts here
  3. Run EverythingNever asks

Codex modes in detail

ModeHow to turn it onAsks youWhat it allows
read-only
--sandbox read-only, /permissions, or sandbox_mode in config.toml
For some actions
Codex can read files and run commands but cannot edit. This is the start state outside version-controlled folders.
workspace-write with on-request (Auto)
Default in version-controlled folders; --sandbox workspace-write --ask-for-approval on-request
For some actions
Edits and commands in the workspace run inside the sandbox. Codex asks before leaving the sandbox or using network access it has not been granted.
granular approvals
approval_policy set to granular in config.toml
For some actions
You keep chosen approval categories interactive (sandbox, rule, MCP, permission and skill-script prompts) and the rest are rejected automatically.
never
--ask-for-approval never or -a never
Never
Approval prompts are off. The sandbox mode still limits what Codex can do.
danger-full-access
--sandbox danger-full-access
For some actions
No sandbox. Approval policy still applies unless you also set never.
yolo
--yolo or --dangerously-bypass-approvals-and-sandbox
Never
Removes both the sandbox and approvals. Web search defaults to live results in full-access modes.

Cursor modes in detail

ModeHow to turn it onAsks youWhat it allows
Allowlist
Settings > Agents > Approvals & Execution, or permissions.json
Before each action
Only actions on your allowlist run without approval. Supported shell commands can run in the sandbox when sandboxing is on.
Auto-review
Settings > Agents > Approvals & Execution
For some actions
Allowlisted calls run. Other shell commands run in the sandbox when possible. A classifier reviews calls that cannot use the sandbox.
Run Everything
Settings > Agents > Approvals & Execution
Never
Every tool call runs automatically with no sandbox and no classifier.

Where their settings live

Codex

PathWhat it holds
~/.codex/config.toml
User config shared by CLI, IDE extension and app
.codex/config.toml
Project config, loaded only for a trusted project
/etc/codex/config.toml
System config on Unix
/etc/codex/requirements.toml
Admin constraints users cannot override
/etc/codex/managed_config.toml
Legacy managed defaults reapplied at startup
~/.codex/AGENTS.md
Global instructions; AGENTS.override.md is read first
~/.codex/hooks.json
User hooks; project hooks in .codex/hooks.json, system in /etc/codex/hooks.json
~/.codex/history.jsonl
Prompt history, size capped by history.max_bytes
~/.codex/sessions/
Per-session rollout JSONL files by date
~/.codex/archived_sessions/
Sessions moved by archive

Cursor

PathWhat it holds
~/.cursor/permissions.json
User allowlists and Auto-review instructions
.cursor/permissions.json
Project allowlists, meant to be committed
~/.cursor/sandbox.json
User sandbox network and path rules
.cursor/sandbox.json
Project sandbox rules, win over the user file
~/.cursor/hooks.json
User hooks
.cursor/hooks.json
Project hooks
/Library/Application Support/Cursor/hooks.json
Enterprise hooks on macOS
~/.cursor/mcp.json
User MCP servers
.cursor/rules/
Project rules in .mdc files
.cursorignore
Files hidden from the agent

Security advisories

Public advisories and well-documented reported issues since 2025. A longer list can mean more people are looking, so read each one rather than the count.

Codex

1Listed here
1With a CVE or GHSA id
1Name a fix

Cursor

8Listed here
8With a CVE or GHSA id
7Name a fix

Both, newest first

  1. CursorCVE-2026-73217High

    On macOS, an agent in Auto-Run Sandbox mode could swap a Python virtual environment's interpreter for a wrapper. The Python extension then ran it outside the sandbox with the user's privileges.

    Fixed in 3.1.2
  2. CursorCVE-2026-73218High

    On macOS with Docker Desktop and the Dev Containers CLI, an agent in Auto-Run Sandbox mode could start a privileged container and reach the home directory without a prompt. The advisory lists no patched version.

    No fixed version published
  3. CursorCVE-2026-61613High

    Web content loaded in a browser enabled Cloud Agent session could reach a local agent endpoint with no authentication. That allowed code execution in the sandbox and exposed repo files, environment variables and GitHub App tokens.

    Fixed in Server side fix on 2026-03-31
  4. CursorCVE-2026-50549Critical

    If the sandbox could not resolve a write target, it fell back to the in-workspace path and skipped approval. A symlink pointing outside the workspace could then lead to unsandboxed code execution.

    Fixed in 3.0
  5. CursorCVE-2026-50548Critical

    The default sandbox allowed writes to a command's working directory, and the agent could set that parameter to a path outside the workspace. That allowed overwriting the cursorsandbox helper and unsandboxed code execution.

    Fixed in 3.0
  6. CursorCVE-2026-48124High

    Cursor Desktop ran hook commands from a workspace's .claude/settings.local.json without specific approval. A malicious workspace or agent-created file could run local commands at the end of a turn.

    Fixed in 3.0.0
  7. CursorCVE-2026-26268High

    A sandboxed agent could write to unprotected .git settings and plant Git hooks that later ran code outside the sandbox, for example after a prompt injection.

    Fixed in 2.5
  8. CursorCVE-2025-64106High

    A validation flaw in MCP server install deep-links let a crafted link skip the security warning and hide the commands to be run. Accepting a dialog that looked like a Playwright install ran the attacker's commands.

    Fixed in 2.0
  9. CodexGHSA-w5fx-fh39-j5rwHigh

    CVE-2025-59532. A sandbox configuration bug let a model-generated working directory become the writable root, so writes could land outside the folder where the session started. The network restriction was not affected.

    Fixed in CLI 0.39.0, VS Code extension 0.4.12

Strengths and things to watch

Codex

What it does well

  • The sandbox is on by default and uses OS mechanisms: Seatbelt on macOS, bwrap and seccomp on Linux.
  • Network is off by default and is a separate setting from approvals.
  • .git, .codex, .agents and .aws stay read-only inside writable roots.
  • Admins can enforce approval policies, sandbox modes, hooks, MCP allowlists and network domains with requirements.toml, including through macOS MDM.
  • Project config, hooks and rules load only after you trust the project.

What to watch for

  • --yolo removes both the sandbox and approvals in one flag.
  • Domain rules restrict traffic only when the network_proxy feature is on.
  • The docs describe hooks as a guardrail, and hosted tools such as web search do not pass through them.
  • The docs checked today do not describe the ~/.codex/sessions/ folder or its file format.
  • approval_policy = "untrusted" is retired and can stop the client from starting if left in config.

Cursor

What it does well

  • Auto-review runs shell commands in a Seatbelt sandbox on macOS where it can, with a classifier for the rest.
  • Sandbox network access is blocked by default and opened by a host allowlist you can edit per project.
  • Protected paths such as .git/hooks, .git/config, .vscode and .cursorignore are write protected inside the sandbox.
  • Hooks cover shell, MCP and file reads, can deny, and have a failClosed option. Enterprise hooks live in a system path.
  • Admins can enforce run modes, sandbox network rules, MCP allowlists and Privacy Mode from the dashboard, and local files cannot weaken them.

What to watch for

  • The docs say Auto-review is not a security boundary and run modes are best effort guardrails.
  • Commands that cannot use the sandbox, or that fail in it, can run outside it after a classifier check or a prompt.
  • Run Everything turns off the sandbox and the classifier. Read access outside the workspace is allowed by default.
  • Most 2026 advisories are sandbox escapes through paths, symlinks, Git hooks and helper processes, so keep the app updated.
  • Hooks fail open on a crash or timeout unless failClosed is set. The editor and the legacy cursor-agent CLI differ in sandbox config, and the CLI's default sandbox state is not documented.

Which should you pick

Pick Codex if

  • You want to be asked, by a person, whenever a command leaves the sandbox.
  • You want an open source CLI (Apache-2.0) you can read and run in CI.
  • You want OpenAI models and already pay for ChatGPT.
  • You want .aws and .git read-only inside the folders the agent can write.

Pick Cursor if

  • You want the agent inside an editor, with models from several providers.
  • You want fewer prompts, with a classifier handling routine commands.
  • Your company wants run modes and MCP allowlists set in a dashboard, with audit logs.
  • You already use Cursor or Grok Build.

Running both

Both read AGENTS.md, so one file of project instructions reaches both. Their enforced settings are separate: Codex's in config.toml and requirements.toml, Cursor's in permissions.json, sandbox.json and hooks.json. Set the same limits in each.

Where Excellent fits

What Excellent doesCodexCursor
Reads its session logs (free scan)
Yes
Yes
Key finder reads its key files
Yes
Yes
Live check before risky actions (Pro)
Yes, in its own hook settings
Yes, in its own hook settings
Before a force push to main
Refuses and tells Codex to ask you
Refuses and tells Cursor to ask you
Excellent's sandbox (Pro)
Yes, in its own sandbox settings
No
Rule sharing
Yes
No

Excellent reads the session logs of both Codex and Cursor on your Mac. The free scan shows what each did: your email in request commands or form inputs, keys sitting in logs, secrets files read, history overwritten, checks skipped. Each finding says which agent and where.

With Pro, Excellent adds its live check to each one's own hook settings, after listing what it will change. The same rules apply to both: it blocks your email on its way to a website, an API key typed into a command, and deleting a folder you marked never-delete.

Excellent's sandbox and rule sharing are for Claude Code and Codex only, so here they apply to Codex. The check reads what a command says, so it isn't a wall around your Mac.

Questions

Is Codex or Cursor safer?

Both sandbox commands with no network by default on macOS. Codex asks a person before a command leaves the sandbox, while Cursor's Auto-review can let a classifier decide. If you want a person to approve every escape, Codex's default does that.

Do both run on Windows?

Codex's CLI has a sandbox on macOS, Linux and Windows, and its desktop app runs on macOS and Windows. Cursor's desktop app runs on macOS, Linux and Windows, but its docs list no Windows sandbox.

Which is open source?

The Codex CLI, under Apache-2.0. The docs we read state no source license for Cursor.

Is Cursor still called Cursor?

Yes, as the Grok Build desktop app. SpaceX brought its coding products under the Grok Build brand on November 30, 2026.

Read more

Sources

More agent comparisons

All comparisons →

Check what Codex and Cursor did on your Mac

Get the Mac app