Enterprise
Cursor Enterprise: LLM Safety & Controls
You can't rely on a language model to always make safe decisions, so Cursor splits agent safety into two layers. Security controls, such as command approval, enforcement hooks and sandboxing, block dangerous operations whatever the model suggests. Steering, through rules, commands and MCP, guides the model toward better behavior but doesn't guarantee prevention. Cursor says to use both together.

On this page
- Why can't you just trust the model to behave?
- What deterministic controls block dangerous agent actions?
- How do hooks enforce policy and connect DLP tools?
- When do hooks fire, and what makes them trustworthy?
- What does Sandbox Mode contain?
- Do the model providers' own safety systems protect us?
- How does steering guide the model toward better behavior?
Why can't you just trust the model to behave?
Language models generate text from probability distributions. They don't retrieve facts or run deterministic logic. The same input can produce different outputs, a model can write plausible code that is wrong, and a crafted prompt can steer it, which is called prompt injection. Cursor's answer is to combine two layers instead of trusting the model to behave.
- Security controls
- Deterministic enforcement: hard boundaries that block dangerous operations whatever the model suggests. They include terminal command restrictions, hooks, approval workflows and sandboxing. Cursor calls them your primary defense.
- LLM steering
- Non-deterministic guidance that shapes the model's context and available actions: rules, commands and MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition.. It improves quality but doesn't guarantee prevention.
Security controls are the safety net, and steering reduces how often agents attempt problematic actions in the first place. Steering alone is not a security boundary, because rules are suggestions the model tries to follow, not guarantees.
This exact topic is a hands-on Lesson: Model, MCP, integration and safety controls — about 6 minutes, free to read.
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.
What deterministic controls block dangerous agent actions?
These controls hold whatever the model proposes. For terminal commands, Cursor's LLM safety page gives two defaults. Its terminal section says Cursor asks for your approval before every terminal command and shows the full command, so you can approve, deny or modify it. Its Run Mode section, like the run-modes page, says Auto-review is the default from Cursor 3An older release label for Cursor's multi-agent interface; current product guidance calls the active surface the Agents Window. Press Enter for the full definition..6. Auto-review runs some calls without asking: allowlisted calls, commands that run in the sandbox, and calls its classifier allows.
- Control
- Run modes
- What it enforces
- In Cursor 3An older release label for Cursor's multi-agent interface; current product guidance calls the active surface the Agents Window. Press Enter for the full definition..6+, users pick Auto-review (the default), Allowlist or Run Everything. Auto-review lets allowlisted calls through, puts shell commands in the sandbox where possible, and asks an LLM classifier to allow or block everything else. Run Everything uses neither the sandbox nor the classifier.
- Control
- Enforcement hooks
- What it enforces
- Your own logic at points in the agent loop: before prompt submission, before file reading, after code generation and before terminal execution, to scan, redact or block.
- Control
- .cursorignoreA file listing paths Cursor must never index or read, kept separate from .gitignore. Press Enter for the full definition.
- What it enforces
- Keeps the listed files out of the agent's file reads and context selection. Like .gitignore, but for what Cursor can access.
- Control
- .cursor directory protection
- What it enforces
- Enterprise teams can stop agents from modifying or deleting the .cursor/ directory and its rules and settings without approval.
- Control
- Browser origin controls
- What it enforces
- Enterprise teams allowlist the websites the browser tool may open. Other origins are blocked.
- Control
- Sandboxing options
- What it enforces
- Stronger isolation through Cloud AgentsAgents that run in a Cursor-managed virtual machine, check out the repo, do the work and open a pull request, then shut down, with no load on your laptop. Press Enter for the full definition. (a separate VM), file system permissions or a dedicated development machine.
| Control | What it enforces |
|---|---|
| Run modes | In Cursor 3An older release label for Cursor's multi-agent interface; current product guidance calls the active surface the Agents Window. Press Enter for the full definition..6+, users pick Auto-review (the default), Allowlist or Run Everything. Auto-review lets allowlisted calls through, puts shell commands in the sandbox where possible, and asks an LLM classifier to allow or block everything else. Run Everything uses neither the sandbox nor the classifier. |
| Enforcement hooks | Your own logic at points in the agent loop: before prompt submission, before file reading, after code generation and before terminal execution, to scan, redact or block. |
| .cursorignoreA file listing paths Cursor must never index or read, kept separate from .gitignore. Press Enter for the full definition. | Keeps the listed files out of the agent's file reads and context selection. Like .gitignore, but for what Cursor can access. |
| .cursor directory protection | Enterprise teams can stop agents from modifying or deleting the .cursor/ directory and its rules and settings without approval. |
| Browser origin controls | Enterprise teams allowlist the websites the browser tool may open. Other origins are blocked. |
| Sandboxing options | Stronger isolation through Cloud AgentsAgents that run in a Cursor-managed virtual machine, check out the repo, do the work and open a pull request, then shut down, with no load on your laptop. Press Enter for the full definition. (a separate VM), file system permissions or a dedicated development machine. |
Configure .cursor directory protection and browser controls in the team dashboard (Enterprise only).
Cursor calls the run-mode allowlist best-effort, because a determined agent or prompt injection might get around it, and says to pair it with hooks. The Auto-review classifier isn't a boundary either: it can approve a call you wanted blocked.
.cursorignoreA file listing paths Cursor must never index or read, kept separate from .gitignore. Press Enter for the full definition. is a convenience feature, not a boundary. People can still open ignored files, an agent might find another way to the content, and the terminal and MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. tools can read it. For real protection, use file system permissions or encrypt the data.
Cursor's LLM safety page says a local agent has the same file, command and network access as your user account. If your account can delete files, so can the agent, and that page says it asks for approval first by default. Auto-approval removes the review, so destructive commands or a prompt injection could run before you see them. The sandbox, covered below, narrows this for shell commands that run inside it.
How do hooks enforce policy and connect DLP tools?
Hooks run your own logic at fixed points in the agent loop, and the ones that fire before an action can block it. That makes hooks the place for rules that must hold: block raw git commands, require approval for sudo, block database DROP statements, or scan prompts for secrets before they are sent.
Hooks stop the shell before it runs
0:26 · narratedRead this demo as text
- Ask the agent to run rm -rf on a temp directory. A Rule might say please don't. That is not enough.
- Rejected before the shell ran. The deny-rm hook fired. Change that gate in Cursor Settings, Hooks — not by hoping the model remembers.
Practice next: Practice this yourself in the hands-on module.
Simulated Cursor 3.12 (macOS, light) — beta educational reconstruction, not the real product.
Cursor's LLM safety page names the checkpoints and what to check at each one:
- Before prompt submission
- Scan prompts for API keys, credentials or PIIPersonally Identifiable Information. Data that can identify a person (names, emails, SSNs); regulated and sensitive. Press Enter for the full definition., and block submissions that contain them.
- Before file reading
- Redact or block access to config files with secrets, PIIPersonally Identifiable Information. Data that can identify a person (names, emails, SSNs); regulated and sensitive. Press Enter for the full definition. in logs, or proprietary algorithms.
- After code generation
- Scan generated code for vulnerabilities (SQL injection, XSS), risky licensed code or hardcoded credentials before it is written.
- Before terminal execution
- Block dangerous commands, or route them through an approval workflow.
For data loss prevention (DLP), Cursor documents three integration paths. An endpoint DLP agent can inspect Cursor's network traffic: point it at the *.cursor.sh domains to scan outbound requests and block or alert on violations. Hooks-based DLP runs your own scanning inside the agent loop. The third path calls your existing DLP vendor's API from a hook, which keeps one policy across all your development tools.
You can set the agent to ask before every file read, edit, terminal command or network request. Cursor calls this tedious, because an agent takes many actions per task, and says most teams use hooks to block dangerous operations automatically instead.
When do hooks fire, and what makes them trustworthy?
Hooks fire at defined points in the agent loop, not whenever the model chooses. A hook that fires before an action runs first and can stop it. A hook that fires after an action sees the result, but the step has already happened. The table maps the checkpoints on Cursor's LLM safety page to hook events. The hooks reference documents more, including hooks around MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. tool calls.
- Lifecycle event
beforeSubmitPrompt- Fires when
- After the user hits send, before the backend request.
- What you do there
- Scan the prompt for secrets or PIIPersonally Identifiable Information. Data that can identify a person (names, emails, SSNs); regulated and sensitive. Press Enter for the full definition., and block the submission if it contains any.
- Lifecycle event
beforeReadFile- Fires when
- Before the agent reads a file into context.
- What you do there
- Redact or deny access to config, logs or proprietary source.
- Lifecycle event
beforeShellExecution- Fires when
- Before a terminal command executes.
- What you do there
- Block destructive commands, or route them through an approval workflow.
- Lifecycle event
afterFileEdit- Fires when
- After the agent edits a file.
- What you do there
- Scan the new code for hardcoded credentials, or send it to your DLP API for review.
| Lifecycle event | Fires when | What you do there |
|---|---|---|
beforeSubmitPrompt | After the user hits send, before the backend request. | Scan the prompt for secrets or PIIPersonally Identifiable Information. Data that can identify a person (names, emails, SSNs); regulated and sensitive. Press Enter for the full definition., and block the submission if it contains any. |
beforeReadFile | Before the agent reads a file into context. | Redact or deny access to config, logs or proprietary source. |
beforeShellExecution | Before a terminal command executes. | Block destructive commands, or route them through an approval workflow. |
afterFileEdit | After the agent edits a file. | Scan the new code for hardcoded credentials, or send it to your DLP API for review. |
Each event is a fixed checkpoint. The three before-hooks can stop the step; afterFileEdit runs once the edit is made.
Cursor's pages disagree about the code-generation checkpoint. The LLM safety page says generated code is scanned before it is written to disk. The hooks reference describes afterFileEdit as running once the agent has edited a file, and it lists no output that blocks the edit. Treat that scan as a check after the fact, and keep blocking checks in the before-hooks.
A command hook is a script you write and own, and project hooks are checked into the repository. It doesn't depend on the model deciding to behave: it gives the same answer to the same input, and you can read, test and version it like other code. Prompt-based hooks are different, because they ask an LLM to judge a condition.
By default a hook fails open. If it crashes, times out or exits with any non-zero code except 2, Cursor logs the failure and runs the action anyway. Set failClosed: true on security-critical hooks. Hooks configured in the team dashboard don't take that option.
Cursor runs every matching hook from every source, including the system-wide hooks your organization deploys through MDM, and merges their answers. Any deny wins over ask, and ask wins over allow, whatever the source. A developer's own hook can't cancel a deny from a managed hook.
What does Sandbox Mode contain?
Cursor's sandbox limits what a terminal command can reach on your machine. It applies to shell commands, and MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. calls and other tool calls run outside it. Under Auto-review, shell commands that aren't allowlisted run in the sandbox when they can. Under Allowlist the sandbox is optional, and Run Everything doesn't use it.
- Workspace files
- Read and write access inside the workspace. .cursorignoreA file listing paths Cursor must never index or read, kept separate from .gitignore. Press Enter for the full definition. can hide files from the agent.
- Network access
- Blocked by default, then opened by your network mode and
sandbox.json. The default network mode adds Cursor's built-in domains for common package managers and language tools. - Protected paths
- Write-protected whatever
sandbox.jsonsays, including.git/config,.git/hooks,.vscodeand.cursorignore.
Commands that need more access, such as full network access, writes outside the workspace or privileged operations, can't use the sandbox. Under Auto-review they go to the classifier instead. Reads outside the workspace are allowed by default. Setting Read Access to Workspace makes the agent ask before it reads anything outside.
Sandboxing is available on individual and Teams plans, but Cursor's plan comparison lists enforcing it org-wide as an Enterprise control. Team settings outrank individual and project configuration, and local sandbox.json files can't weaken Enterprise team-admin policies. An Organization Group can still loosen it: when a team and a group disagree, the looser sandbox setting wins. Without a team policy, each developer's settings decide.
Interactive diagram. Tab through its regions; each focused region shows its detail in the panel below.
The containment layers, from allowlists and hooks down to the terminal sandbox and Cloud Agent VMs. Each layer assumes the one above it can fail.
Read the stack from the top. Allowlists set which models and MCPModel Context Protocol. A standard that lets an AI agent pull in context from outside the repo, like Jira tickets or internal docs. Press Enter for the full definition. servers are permitted at all, and hooks catch a permitted action used the wrong way. The terminal sandbox contains a command that gets past a hook. The last layer moves the agent off the laptop: a Cloud Agent runs on its own dedicated machine, so a command that gets past every other layer does its damage there.
On Enterprise, admins can set model access, cloud-distributed hooks and sandbox policy for the whole organization, so those layers don't depend on each developer's settings.
Do the model providers' own safety systems protect us?
Partly. Cursor's LLM safety page says every model provider (OpenAI, Anthropic, Google and SpaceXAI) runs safety systems that filter harmful content. They reject prompts that ask for harmful information, refuse to generate dangerous code and filter outputs. Cursor works with providers so models meet safety standards before they reach users, and providers keep evaluating models for safety issues.
Cursor says these systems can be bypassed or tricked. Count them as one more layer, and implement your own controls through hooks and access policies.
How does steering guide the model toward better behavior?
Security controls block a harmful action after the model suggests it. Steering shapes the suggestion in the first place. Because steering is non-deterministic, it improves outcomes without guaranteeing prevention, so back anything that must hold with an enforcement hook.
- Rules
- Instructions added to Agent's context, scoped as user, project or team rules. Use team rules for company-wide security or compliance standards, and leave out a glob pattern so the rule applies to every conversation. The model tries to follow rules, but they are not guarantees.
- Commands & workflows
- Reusable prompts run with slash commandsSaved multi-step prompts you trigger from the / menu, such as run tests, fix CI or open a pull request. Press Enter for the full definition. such as /test or /deploy. A /security-review command can walk the agent through checks for SQL injection, exposed secrets and input sanitization. Team admins can create organization-wide commands.
- MCP servers
- Model Context Protocol servers give agents access to external data, such as docs, internal APIs and knowledge bases. They enrich context but don't enforce policy: unlike hooks, they inform instead of block.
Frequently asked questions
Is .cursorignore a security boundary?
No. Cursor calls it a convenience feature: agents skip ignored files when they read files and pick context, but people can still open them, and the terminal and MCP tools aren't blocked from them. For real protection, use file system permissions or encrypt the data, and add hooks to scan or block access.
Are Cursor agents sandboxed from my machine?
Partly. Under Auto-review, the default from Cursor 3.6, shell commands that aren't allowlisted run in a sandbox when they can. The sandbox limits where those commands can write and which domains they can reach. Other actions run with your user account's access. For stronger isolation, use Cloud Agents in a separate VM, file system permissions or a dedicated development machine.
Can rules force the model to follow our security standards?
No. Rules steer the model, but they are instructions it attempts to follow, not guarantees. For requirements that must hold, pair team rules with enforcement hooks that block the disallowed operation.
When do hooks run?
At fixed points in the agent loop. beforeSubmitPrompt, beforeReadFile and beforeShellExecution fire before their step and can stop it, while afterFileEdit fires after the agent edits a file. If a hook crashes or times out, the action goes ahead unless the hook is set to fail closed, an option that hooks configured in the team dashboard don't have.
Can a developer override an enterprise hook or turn off Sandbox Mode?
A developer's hook can't cancel a deny from a managed hook, because Cursor runs hooks from every source and any deny wins. A developer also can't turn off a sandbox policy that an Enterprise admin enforces, since local sandbox.json files can't weaken Enterprise team-admin policies. An Organization Group with a looser sandbox setting can loosen it, and without a team policy each developer's own settings decide.
Sources & last verified
- Cursor - LLM Safety & Controls
- Cursor - Hooks
- Cursor - Run Modes
- Cursor - Agent Security
- Cursor - Ignore Files
- Cursor - Rules
- Cursor - MCP
- Cursor - sandbox.json reference
- Cursor - Enterprise plan comparison
- Cursor - Organization Groups
Cursor ships frequently. Last updated October 28, 2026.