Skip to content

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.

Checked

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 -p and Agent SDK runs start in Manual, which asks before edits, shell commands and network access.
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.
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

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.

Safety controls, side by side
QuestionClaude CodeCursor
Sandbox on from the first runNoOpt-in with /sandbox3YesIn Auto-review, the recommended mode17
OS-level sandbox availableYesSeatbelt on macOS, bubblewrap on Linux3YesSeatbelt on macOS, Landlock or Bubblewrap on Linux17
No network in commands by defaultPartlyAsks in Manual mode; with the sandbox, an allowlist that starts empty34YesBlocked in the sandbox until a host list opens it17
Asks you before shell commands by defaultPartlyAuto mode lets a classifier approve; Manual mode asks2PartlyA classifier decides what leaves the sandbox17
Deny rules you writeYesdeny arrays, checked first4NoAllowlists only in the editor13
A hook can block a tool callYesPreToolUse with exit code 2 or a deny5YesSix permission hooks can deny2
Admin policy users cannot overrideYesManaged settings file, MDM or admin console8YesEnterprise dashboard and MDM12456
Admins can turn off the skip-approvals modeYesAdmins can disable bypassPermissions2YesThe dashboard enforces run modes13
Open sourceNoThe sandbox runtime is open source93NoNo source license stated

The basics

QuestionClaude CodeCursor
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
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
macOS, Linux, WSL and native Windows. Installs with a script, Homebrew, WinGet, apt, dnf or apk.1
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
No. The anthropics/claude-code repo holds issues, plugins and examples, and its license file is "All rights reserved" under Anthropic's Commercial Terms. The sandbox runtime is a separate open source package.93
Not documented as open source. The docs reviewed state no source license for the app or the cursor-agent CLI.
Models
Claude models from Anthropic, or third-party providers such as Amazon Bedrock, Google Cloud and Microsoft Foundry. Auto mode needs Opus 4.6 or later, Sonnet 4.6 or later, Haiku 5.5 or a Fable model on the Anthropic API.12
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 with Claude Pro, Max, Ultra, Team and Enterprise plans, not Free. Pro is $20 a month, or $17 a month billed annually. Also usable with an Anthropic Console API account at API rates.101
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

QuestionClaude CodeCursor
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
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, 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
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
Without the sandbox, network commands and WebFetch ask in Manual mode, apart from preapproved documentation domains. With it, traffic goes through a local proxy that checks sandbox.network.allowedDomains, which starts empty.34
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-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
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
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
~/.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. 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
CLAUDE.md in the project and in ~/.claude/, plus CLAUDE.local.md and .claude/rules/. Can read AGENTS.md in place of CLAUDE.md. These are guidance, not enforced.61
.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. HTTP, SSE (deprecated), stdio and WebSocket. Servers live in .mcp.json (project) or ~/.claude.json (local and user scope). Admins can set managed-mcp.json or managedMcpServers.78
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
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
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
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
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

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

  1. planAsks for some actions
  2. default (Manual)Asks before each action
  3. dontAskNever asks
  4. acceptEditsAsks for some actions
  5. autoAsks for some actionsStarts here
  6. bypassPermissionsNever asks

Cursor

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

Claude Code modes in detail

ModeHow to turn it onAsks youWhat 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

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

Claude Code

PathWhat 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

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.

Claude Code

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

Cursor

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

Both, newest first

  1. Claude CodeGHSA-5xjx-9qx6-jcrvHigh

    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 in 2.1.251
  2. Claude CodeGHSA-4p2j-qj3c-6x84High

    Uncontrolled search path let a malicious git executable run arbitrary code. Affects Claude Desktop, listed in the Claude Code repo. CVE-2026-88066.

    Fixed in Claude Desktop 1.8089.0
  3. Claude CodeGHSA-pq7j-f95f-qfcvHigh

    A plugin commit SHA pin could be bypassed, allowing installation of attacker-controlled code. CVE-2026-86063.

    Fixed in 2.1.179
  4. Claude CodeGHSA-5j29-h97v-84chHigh

    Arbitrary file write through write-time symlink following (a time-of-check to time-of-use race). CVE-2026-103435.

    Fixed in 2.1.129
  5. Claude CodeGHSA-gfvf-j8jh-jxxwLow

    Managed settings were not applied when a stored API key was preferred over enterprise sign-in. CVE-2026-103012.

    Fixed in 2.1.260
  6. Claude CodeGHSA-v234-4jrq-mgg6High

    Claude Desktop on macOS: opening a malicious file from a Cowork folder could run commands on the host. Listed in the Claude Code repo.

    Fixed in Claude Desktop 1.15962.0
  7. 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
  8. 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
  9. 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
  10. Claude CodeGHSA-7835-87q9-rgvvHigh

    Git worktree path confusion allowed a sandbox escape and unsandboxed code execution. CVE-2026-55607.

    Fixed in 2.1.163
  11. Claude CodeGHSA-4vp2-6q8c-pvq2Medium

    An insecure temporary file in the /copy command allowed response disclosure and a symlink-based file write. CVE-2026-46406.

    Fixed in 2.1.128
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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

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.
  • PreToolUse hooks can block a call before it runs, and onFailure: "block" makes a failed hook fail closed.
  • Transcripts and pre-edit file snapshots are kept locally, with claude purge and cleanupPeriodDays to 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, unless denyRead or similar settings narrow them.
  • A failed sandboxed command can be retried unsandboxed with dangerouslyDisableSandbox unless allowUnsandboxedCommands is false.
  • Bash rules match command text, so Bash(rm *) does not match /bin/rm or bash -c 'rm ...'. The docs point to the sandbox for stronger enforcement.
  • Transcripts are plaintext, so a value read from a .env file 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, .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 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 doesClaude CodeCursor
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

Sources

More agent comparisons

All comparisons →

Check what Claude Code and Cursor did on your Mac

Get the Mac app