Claude Code vs Cursor: sandbox, approvals and security compared
Claude Code and Cursor side by side on sandboxing, run modes, network access, hooks, admin policy and public advisories, with a source for every fact.
Claude Code
- Made by
- Anthropic
- Out of the box
- From v2.1.283, interactive terminal and VS Code sessions start in auto mode, where a classifier reviews actions. Without a supported model it starts in Manual.
claude -pand Agent SDK runs start in Manual, which asks before edits, shell commands and network access. - Sandbox
- Yes, off by default. Turn on with
/sandboxorsandbox.enabled. macOS uses Seatbelt, Linux and WSL2 use bubblewrap. Not supported on native Windows. Covers Bash, PowerShell and Monitor commands only. File tools, MCP servers and hooks run outside it. - Public advisories
- 8 with a CVE or GHSA id, 6 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
On this page
Short answer
Claude Code is a terminal-first agent with its own permission rules. Cursor is an editor whose agent runs commands under a run mode you pick, and on November 30, 2026 it became the desktop app of Grok Build. Both use Seatbelt on macOS. Cursor's recommended Auto-review mode sandboxes shell commands where it can and blocks network inside the sandbox. Claude Code's sandbox is off until you turn it on. Claude Code has the more detailed allow, ask and deny rules. Cursor gives teams dashboard controls and audit logs. Neither vendor calls its guardrails a hard security boundary.
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.
PreToolUse with exit code 2 or a deny5●YesSix permission hooks can deny2The basics
| Question | Claude Code | Cursor |
|---|---|---|
Runs in | Terminal CLI, VS Code and JetBrains extensions, desktop app, web at claude.ai/code, mobile app, GitHub Actions and GitLab CI/CD, and an Agent SDK.1 | |
Platforms | macOS, Linux, WSL and native Windows. Installs with a script, Homebrew, WinGet, apt, dnf or apk.1 | |
Open source | Not documented as open source. The docs reviewed state no source license for the app or the cursor-agent CLI. | |
Models | 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 | 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
| Question | Claude Code | Cursor |
|---|---|---|
Out of the box | From v2.1.283, interactive terminal and VS Code sessions start in auto mode, where a classifier reviews actions. Without a supported model it starts in Manual. claude -p and Agent SDK runs start in Manual, which asks before edits, shell commands and network access.2 | |
Sandbox | Yes, off by default. Turn on with /sandbox or sandbox.enabled. macOS uses Seatbelt, Linux and WSL2 use bubblewrap. Not supported on native Windows. Covers Bash, PowerShell and Monitor commands only. File tools, MCP servers and hooks run outside it.3 | |
Network in commands | ||
Turning approvals off | --dangerously-skip-permissions, same as --permission-mode bypassPermissions. Skips prompts and safety checks. Deny rules and explicit ask rules still apply. Docs say to use it only in containers or VMs. Admins can disable it.2 | |
Permission rules | permissions.allow, ask and deny arrays in settings.json, for example Bash(npm run test *) and Read(./.env). Deny is checked first, then ask, then allow. /permissions lists them.4 | |
Hooks before a tool runs | Yes. PreToolUse hooks run before a tool call and can block it with exit code 2 or a deny decision. Types are command, http, mcp_tool, prompt and agent. A crashed hook does not block unless onFailure is block.5 | 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 | .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 | ||
Session history | Plaintext JSONL transcripts at ~/.claude/projects/<project>/<session>.jsonl, prompt history in ~/.claude/history.jsonl. Transcripts are deleted after 30 days by default (cleanupPeriodDays)6 | |
Admin policy | Yes. /Library/Application Support/ClaudeCode/managed-settings.json on macOS, a com.anthropic.claudecode MDM profile, or server-managed settings from the claude.ai admin console. Users and project files cannot override them.8 |
The differences that matter
Cursor is now part of Grok Build
Cursor joined SpaceX in August 2026, and on November 30 its products came under the Grok Build brand, with Cursor as the desktop app. Its docs now live at docs.grok.com. Grok Build's separate terminal app, grok, is a different product and is not what this page compares.
Who decides what runs
Cursor's Auto-review mode runs allowlisted calls, runs other shell commands in its sandbox where it can, and sends the rest to an AI classifier. Claude Code's interactive sessions start in auto mode, where a classifier also reviews actions, and scripted runs start in Manual mode, which asks. Cursor's docs say Auto-review is not a security boundary.
The sandbox and the network
In Cursor, sandboxed commands have no network by default, and sandbox.json plus a built-in list of package and git hosts opens it. Commands that need more can leave the sandbox after a prompt or the classifier's review. Claude Code's sandbox is opt-in, covers shell commands only, and sends traffic through a proxy whose list of allowed domains starts empty.
Rules
Claude Code has allow, ask and deny arrays in settings.json, with deny checked first. Cursor has a terminal allowlist, an MCP allowlist and plain-English auto-run instructions in permissions.json, and its docs show no deny syntax for the editor.
Hooks and admin control
Both have hooks that can block a call before it runs. Cursor's fail open on a crash unless failClosed is set, and Claude Code's do unless onFailure is block. Cursor's Enterprise dashboard enforces run modes, sandbox network rules and MCP allowlists and streams audit logs to a SIEM. Claude Code's managed settings come from a file, an MDM profile or the Claude admin console.
Public advisories
Cursor's repository lists eight advisories from November 2025 to July 2026, two rated critical and most of them sandbox escapes. Claude Code's lists eight since June 2026, six rated high. Nearly all were fixed in a release or on the server, so keeping either one updated matters more than the count.
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.
Claude Code
- planAsks for some actions
- default (Manual)Asks before each action
- dontAskNever asks
- acceptEditsAsks for some actions
- autoAsks for some actionsStarts here
- bypassPermissionsNever asks
Cursor
- AllowlistAsks before each action
- Auto-reviewAsks for some actionsStarts here
- Run EverythingNever asks
Claude Code modes in detail
| Mode | How to turn it on | Asks you | What it allows |
|---|---|---|---|
plan | Shift+Tab, --permission-mode plan or /plan | For some actions | Reads and proposes changes without editing source until you approve the plan. |
default (Manual) | --permission-mode default or permissions.defaultMode | Before each action | Prompts for most edits, shell commands and network access. Reads in the working directory run without asking. |
dontAsk | --permission-mode dontAsk (not in the Shift+Tab cycle) | Never | Denies every call that would prompt. Only reads and pre-approved tools run. |
acceptEdits | Shift+Tab, --permission-mode acceptEdits | For some actions | Auto-approves edits and common filesystem commands in the working directory. Other Bash commands still prompt. |
auto | Shift+Tab, --permission-mode auto or defaultMode in user settings | For some actions | A classifier model blocks risky actions such as curl | bash and force pushes. Pauses and prompts after 3 blocks in a row or 20 in total. |
bypassPermissions | --dangerously-skip-permissions or --permission-mode bypassPermissions | Never | Skips prompts and safety checks. Deny rules and explicit ask rules still apply. Docs say it offers no protection against prompt injection. |
Cursor modes in detail
| Mode | How to turn it on | Asks you | What 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
Claude Code
| Path | What it holds |
|---|---|
~/.claude/settings.json | User settings, permissions and hooks |
.claude/settings.json | Project settings, shared in git |
.claude/settings.local.json | Personal project settings, gitignored |
/Library/Application Support/ClaudeCode/managed-settings.json | Admin-managed policy on macOS |
~/.claude.json | Account state, trust decisions, local and user MCP servers |
.mcp.json | Project MCP servers |
~/.claude/projects/ | Session transcripts and auto memory |
~/.claude/history.jsonl | Prompt history |
~/.claude/file-history/ | Pre-edit file snapshots for checkpoint restore |
CLAUDE.md | Project instructions |
Cursor
| Path | What 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.
Claude Code
Cursor
Both, newest first
A race in the Edit tool's path check let a process in the Bash sandbox swap a parent directory for a symlink, so the unsandboxed Edit tool could overwrite a file outside the workspace on macOS. CVE-2026-88968.
Fixed in2.1.251Uncontrolled search path let a malicious git executable run arbitrary code. Affects Claude Desktop, listed in the Claude Code repo. CVE-2026-88066.
Fixed inClaude Desktop 1.8089.0A plugin commit SHA pin could be bypassed, allowing installation of attacker-controlled code. CVE-2026-86063.
Fixed in2.1.179Arbitrary file write through write-time symlink following (a time-of-check to time-of-use race). CVE-2026-103435.
Fixed in2.1.129Managed settings were not applied when a stored API key was preferred over enterprise sign-in. CVE-2026-103012.
Fixed in2.1.260Claude Desktop on macOS: opening a malicious file from a Cowork folder could run commands on the host. Listed in the Claude Code repo.
Fixed inClaude Desktop 1.15962.0On 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 in3.1.2On 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 publishedWeb 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 inServer side fix on 2026-03-31Git worktree path confusion allowed a sandbox escape and unsandboxed code execution. CVE-2026-55607.
Fixed in2.1.163An insecure temporary file in the
Fixed in/copycommand allowed response disclosure and a symlink-based file write. CVE-2026-46406.2.1.128If 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 in3.0The 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
Fixed incursorsandboxhelper and unsandboxed code execution.3.0Cursor Desktop ran hook commands from a workspace's
Fixed in.claude/settings.local.jsonwithout specific approval. A malicious workspace or agent-created file could run local commands at the end of a turn.3.0.0A sandboxed agent could write to unprotected
Fixed in.gitsettings and plant Git hooks that later ran code outside the sandbox, for example after a prompt injection.2.5A 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 in2.0
Strengths and things to watch
Claude Code
What it does well
- Permission rules and hooks are enforced by Claude Code, not by the model, and deny rules apply in every mode.
- Managed settings rank above user, project and command-line values, and admins can disable bypass and auto modes.
- An OS-level sandbox with a domain allowlist and credential and filesystem controls is available, built on an open source runtime.
PreToolUsehooks can block a call before it runs, andonFailure: "block"makes a failed hook fail closed.- Transcripts and pre-edit file snapshots are kept locally, with
claude purgeandcleanupPeriodDaysto control retention.
What to watch for
- The sandbox is off by default and covers Bash, PowerShell and Monitor commands only. Edit, Read, Write, WebFetch, MCP servers and hooks run outside it.
- Sandboxed reads cover most of the machine by default, including
~/.ssh, unlessdenyReador similar settings narrow them. - A failed sandboxed command can be retried unsandboxed with
dangerouslyDisableSandboxunlessallowUnsandboxedCommandsisfalse. - Bash rules match command text, so
Bash(rm *)does not match/bin/rmorbash -c 'rm ...'. The docs point to the sandbox for stronger enforcement. - Transcripts are plaintext, so a value read from a
.envfile or printed by a command is written to~/.claude/projects/.
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,.vscodeand.cursorignoreare write protected inside the sandbox. - Hooks cover shell, MCP and file reads, can deny, and have a
failClosedoption. 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
failClosedis set. The editor and the legacycursor-agentCLI differ in sandbox config, and the CLI's default sandbox state is not documented.
Which should you pick
Pick Claude Code if
- You work in the terminal, or want an agent you can script and run in CI.
- You want allow, ask and deny rules per tool and path.
- You want plaintext session transcripts on disk that you can read and search.
- Your team already pays for Claude.
Pick Cursor if
- You want the agent inside an editor, with a choice of models from several providers.
- You want shell commands sandboxed with no network by default, without setup.
- Your company wants run modes and MCP allowlists enforced from a dashboard, with audit logs sent to a SIEM.
- You already use Cursor, or Grok Build through The X Subscription.
Running both
Many people use Cursor for editing and Claude Code in its terminal. They read different instruction files: Cursor reads .cursor/rules and AGENTS.md, and Claude Code reads CLAUDE.md and can read AGENTS.md. Keeping shared instructions in AGENTS.md reaches both. Set each agent's own rules and hooks too, since instructions are guidance only.
Where Excellent fits
| What Excellent does | Claude Code | Cursor |
|---|---|---|
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 | Claude Code asks you first | 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 Claude Code 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 Claude Code. The check reads what a command says, so it isn't a wall around your Mac.
Questions
Is Cursor the same as Grok Build now?
Cursor is now the desktop app of Grok Build, after SpaceX brought its coding products under that brand on November 30, 2026. The Cursor app and its docs carry on, now at docs.grok.com.
Does Cursor run agent commands in a sandbox?
In Auto-review mode, and optionally in Allowlist mode, it runs shell commands in a sandbox: Seatbelt on macOS, Landlock or Bubblewrap on Linux. Run Everything mode has no sandbox. The docs list no Windows sandbox.
Does Claude Code have a sandbox?
Yes, off by default. Turn it on with /sandbox or sandbox.enabled. It covers shell commands, and file tools, MCP servers and hooks run outside it.
Which is safer for a company to roll out?
Both give admins settings that users cannot override. Cursor's are set in a team dashboard with audit logs. Claude Code's come from a managed settings file, an MDM profile or the admin console. Pick the one that fits how you already manage devices.
Read more
- Claude Code: safety and how to run it
- Cursor: safety and how to run it
- All agents Excellent works with
Sources
Claude Code
- Claude Code docs: Overview
- Claude Code docs: Permission modes
- Claude Code docs: Sandboxing
- Claude Code docs: Permissions
- Claude Code docs: Hooks
- Claude Code docs: Explore the .claude directory
- Claude Code docs: MCP
- Claude Code docs: Deploy managed settings
- anthropics/claude-code: LICENSE.md
- Claude pricing
- anthropics/claude-code: Security advisories
Cursor
- Cursor docs (now Grok Build docs): Run modes, sandboxing and auto-review
- Cursor docs: Agents Window hooks
- Cursor docs: Terminal UI permissions
- Cursor docs: Model and integration management (MCP allowlists)
- Cursor docs: Enterprise
- Cursor docs: Security and privacy hardening
- Cursor docs: Agent security
- Cursor docs: Rules
- Cursor docs: MCP
- Cursor docs: Customize overview
- Cursor docs: Privacy and data
- Cursor docs: Legacy plans
- cursor.com homepage
- Announcement: Cursor is now Grok Build
- GitHub Security Advisories for cursor/cursor




