Cursor sandbox: how Cursor runs agent commands and where it stops
The Cursor sandbox lets terminal commands run without giving them full machine access. On macOS it uses Seatbelt, a built-in system feature, through sandbox-exec, with no extra setup, on Cursor 2.0 or later. A sandboxed command can work in your project, but it cannot freely read protected files, write outside approved paths or contact arbitrary network destinations. Reads outside the workspace are open by default, and a failed command can be rerun outside the sandbox.
This page explains how the Cursor sandbox works on a Mac: what it fences, what it does not, and how its network and read settings change the picture.
01What the Cursor sandbox does
A sandbox is a fenced area that a program cannot leave, even if it tries. Cursor builds one around the terminal commands its agent runs. It does not fence the editor, extensions or your other apps. Only commands.
On a Mac the fence is made with Seatbelt, driven through a tool called sandbox-exec. A generated profile limits file access, network access and other process behavior for the full subprocess tree. The subprocess tree means every program the command starts, and the programs those start.
Writing outside approved paths is not allowed. Cursor also protects paths like .git/config, .git/hooks, .vscode, .cursorignore and sensitive Cursor config files.
02What is fenced and what is not
| Area | Inside the sandbox |
|---|---|
| Working in your project | Allowed |
Protected paths such as .git/hooks | Protected |
| Writing outside approved paths | Not allowed |
| Network | Closed until your network mode opens it |
| Reading files outside the workspace | Open by default, called System read access |
| Commands that need full system access | Bypass the sandbox; Cursor asks for your approval |
The row to remember is the fifth one. The agent can read files outside the workspace without approval, and that is the default. A Workspace read mode exists, but it requires Cursor 3.23 or later. If the agent can read your ~/.ssh folder, the wall on writing does not help much, so choose the narrower read setting when your version offers it.
03The network rules
The sandbox network is blocked by default and then opened by your network mode and sandbox.json. A sandbox.json is a settings file where you list what the sandbox may reach. A list of permitted places like that is called an allowlist. One file at ~/.cursor/sandbox.json applies to all your projects.
You choose one of three network modes:
sandbox.jsonOnly. Only the domains in your allowlist; Cursor's defaults are not added.sandbox.jsonplus Defaults. Your allowlist plus Cursor's built-in defaults for common package managers and language tools. This is the default.- Allow All. All network access is allowed, regardless of
sandbox.json.
So in the default mode some hosts are open from the start. The built-in list includes github.com among its hosts. A host that many people use is also a host that data can be sent to, so the default list is convenient, not tight.
Team admins can add their own limits. Team-admin policies and Cursor's hardcoded security rules layer on top, so local files cannot weaken those protections.
04The way out: a rerun outside the sandbox
Two doors lead out of it, and both are by design.
First, some commands need full system access and bypass the sandbox. Cursor indicates when a command runs outside it and asks for your approval.
Second, a retry. If a sandboxed command fails on a sandbox restriction, such as a permission error, the agent can rerun it outside the sandbox, and a classifier reviews that rerun. A classifier is a separate small model that judges whether an action looks safe. It runs on the Cursor backend, and it can make mistakes in both directions: it can allow a call you would have blocked, or block a call you would have allowed.
So the real question is not only what the sandbox blocks, but who decides when it is bypassed. Cursor's answer is a classifier and your approval.
05Run modes: where the sandbox sits
Run modes are the approval settings for the agent. You find them in Settings > Agents > Approvals & Execution. Cursor describes three: Auto-review, Allowlist and Run Everything. Auto-review is the recommended default, and the safest useful setup for most people. It runs known-safe calls, sandboxes shell commands when it can, and asks a classifier to review anything else.
Do not mistake the modes for walls. Cursor says Auto-review is not a security boundary, because the classifier can make mistakes. The docs call run modes best-effort guardrails, not a hard security boundary. The sandbox is the part the operating system enforces through Seatbelt.
Cursor also has three extra protections that can ask for approval even when the run mode would not. File-Deletion Protection prevents the agent from automatically deleting files, including rm commands. External-File Protection prevents automatic changes outside the workspace. Browser Protection prevents the agent from automatically running Browser tools. The wider picture is on Cursor YOLO mode.
06A five-minute check of your own setup
Open Settings > Agents > Approvals & Execution and go down this list.
- Run mode. See which of the three is selected. Auto-review is the recommended one.
- Read access. The default is System, which reaches outside the workspace. If you are on Cursor 3.23 or later, pick Workspace.
- Network mode. The default is
sandbox.jsonplus Defaults. Do not switch to Allow All unless you must, because it opens all network access. - Protections. Look at File-Deletion, External-File and Browser Protection from the section above, and turn on the ones you want.
Cursor's Cloud Agents are different. They run inside their own dedicated machine and do not use run modes, so the agent never asks you to approve an action.
07Sandbox escapes that were fixed
The wall has had holes. Several advisories, public notices of a security flaw with a CVE number, concern this sandbox. Two examples: CVE-2026-26268 let a prompt-injected agent write to protected git settings, and it was fixed in Cursor 2.5. CVE-2026-50549, rated critical and published June 5, 2026, let a write go through without approval by way of a symlink, a file that points somewhere else. Prompt injection means text hidden in something the agent reads that tells it to act against you.
The full advisory list lives on Cursor security. Keep Cursor updated, because fixes ship in new versions.
08When a container is the better wall
The Cursor sandbox limits commands, and nothing else. For a stricter wall, such as runs without prompts, put the whole agent in a container or VM. A container is a lightweight isolated environment for running programs. A VM, or virtual machine, is a whole separate computer simulated inside yours. The container setup is on Claude Code devcontainer, and the same idea holds for Cursor. Side by side with the rest, the four agents are in sandbox for an AI agent, with their own pages Claude Code sandbox and Codex sandbox.
09Should you rely on the Cursor sandbox?
Use the Cursor sandbox with Auto-review as a daily guardrail on a Mac you trust, and narrow the read access if your version allows it. Keep your SSH keys and cloud credentials out of reach of every agent, whatever the mode. Do not treat it as a vault: it can be bypassed by design and has been escaped in practice. Questions about the editor itself are on Is Cursor safe.
A sandbox limits what a command can touch; it doesn't show what already ran. Cursor's sandbox decides what a command may touch; Artificial Immunity's free, open-source core watches Cursor sessions and program starts on your Mac and reports what it finds.
FAQ
Does Cursor use a sandbox on a Mac?
Yes. On macOS Cursor uses Seatbelt through sandbox-exec, with no extra setup, on Cursor 2.0 or later. A generated profile limits file access, network access and other process behavior for the whole subprocess tree.
Can a sandboxed Cursor command reach the internet?
Only through the network mode you chose. Nothing is open until a network mode opens it, and the default mode adds built-in defaults for common package managers and language tools, plus your sandbox.json list.
Can the Cursor agent read files outside my project?
By default, yes. The default read access is System, which lets the agent read files outside the workspace without approval. A Workspace read mode exists in Cursor 3.23 or later.
What happens when a sandboxed command fails?
The agent can rerun it outside the sandbox, and Cursor's classifier reviews that rerun. Cursor also marks commands that run outside the sandbox and asks for your approval.
Is Cursor Auto-review the same as the sandbox?
No. The sandbox is an operating-system boundary for commands. Auto-review is a classifier that checks calls, and Cursor says it is not a security boundary.
Do Cursor cloud agents use the sandbox and run modes?
No. Run modes are the approval settings for the agent on your Mac. Cloud Agents run inside their own dedicated machine, so the agent never asks you to approve an action.