AI agent security

Claude Code vs Cursor security: do built-in controls suffice?

Key takeaways

What does "secure" mean for a coding agent?

Securing a coding agent means controlling what it actually does at runtime: the commands it runs, files it writes and network or tool calls it makes. The test is whether each action matches both your policy and the user's intent.

Permission rules and sandboxes handle the first half well. The gaps appear in central governance, evidence and the second half, intent.

What Claude Code and Cursor already do well

Both tools give admins real controls, and they cut down on destructive accidents and permission fatigue.

Claude Code uses allow, ask and deny rules per tool. You can inspect them with /permissions, which lists each rule and the settings.json file it comes from. Managed settings let admins enforce rules and hooks (scripts that run around tool calls), and sandboxing restricts what Bash commands can touch. Auto mode reduces prompts by having a classifier approve routine actions.

Cursor separates run modes and permissions from sandboxing, which you can configure with a sandbox.json file. Privacy Mode governs whether your code is retained or used for training, and admins can enforce it for a team.

These are good products. Their scope is the problem.

Where do built-in controls stop?

They stop at the boundary of one tool, one machine's config and one action at a time. Three gaps matter most for enterprises.

One policy across several agents

Teams rarely run a single agent. Claude Code, Codex, Copilot CLI and Cursor each have their own schema, rollout cadence and bypass paths, so policy drifts. Watcher applies one policy to Claude Code, Codex and Copilot CLI through built-in connections, and to other harnesses through gateway hooks or SDK examples. Admin-locked managed settings roll out through MDM, so developers can't switch them off.

Evidence, not only prevention

"We blocked it" isn't the same as "we can show what happened and why." Auditors and incident responders need the task, the tool calls, the results and the security decision for each. Watcher Analyzer shows each session in that context. Findings can flow to a SIEM through the Watcher Python SDK and API, with example exporters for Google Security Operations, Microsoft Sentinel, Splunk HEC and OpenTelemetry.

Allowed is not the same as intended

A sandbox can't tell whether a permitted action fits the task. An agent might run an allowed Terraform command that changes production infrastructure, or use credentials the task never needed. Watcher's blocking review checks a tool call before it runs and allows, denies or escalates it. Trailing review grades the whole session to catch patterns that no single action shows. A sandbox limits what an agent can reach, while Watcher judges whether what it does inside those limits is what the person asked for.

When are built-in controls enough, and when do you need more?

Count your answers against four factors: agent count, supervision, data sensitivity and audit strictness.

FactorBuilt-ins may be enoughAdd a runtime layer
Agent harnessesOneTwo or more
SupervisionDeveloper watches every sessionUnattended or overnight runs
DataLow-value code, no PIIHigh-value secrets or PII
AuditInformalEvidence required for auditors

If you sit in the left column on all four, strong managed settings plus OS-level sandboxing and egress controls are a sound choice. Verify them first: confirm developers can't override managed settings, confirm the sandbox and network limits hold, and run prompt-injection and tool-misuse tests.

Two or more rows on the right is a signal to add a control layer built like MDM. It complements IDE safeguards and doesn't replace them.

How should you roll out a runtime layer?

Work in order, and don't turn on blocking first.

  1. Set the baseline: permissions, sandboxing and Privacy Mode.
  2. Run observe-only for a few weeks. Watcher records sessions without holding up work, so you can see what agents really do and tune thresholds.
  3. Enable blocking for the actions that matter, using severity thresholds.
  4. Keep policy with security. Engineering works as normal, and evidence feeds your SIEM.

Watcher can run in your own AWS, Azure or on-premises environment, and no session data reaches Apollo unless you choose to share it. That answers the worry about a new store of everything engineers do.

Autonomy follows trust. With more capable models and Watcher's independent monitoring, DNV engineers leave agents unattended for over an hour in 10% of sessions, up from under 1%.

What should you test in a pilot?

Test these five things before you commit.

  1. Policy drift: confirm managed settings and hooks apply on every machine and subproject.
  2. Allowed but wrong: run multi-step tasks where each action is permitted but the sequence strays from the request.
  3. Egress and credentials: attempt requests to disallowed endpoints and use of unneeded credentials.
  4. Mode behavior: observe-only must log without blocking, and enforce must stop the call before it runs.
  5. Escalation: check that humans get prompted. In Claude Code, an escalation surfaces at its own permission prompt, but a claude -p run can't show one, so Watcher denies the call at once.

So, are the built-ins enough?

For a small, single-agent, low-risk setup, yes, if you verify them. As scope grows, they become necessary but insufficient, because you need central policy, evidence and judgment about intent. The practical path is to keep the built-ins, add monitoring in observe-only mode, then enforce selectively. A free agent security audit is a low-effort way to see what your agents do today.

Frequently asked questions

Are Claude Code managed permissions and Cursor Privacy Mode enough to stop secrets exfiltration?

They reduce risk but don't close it. Permissions limit which tools run, and Privacy Mode governs vendor-side data handling. Neither judges whether an allowed command is using a credential the task didn't need, so pair them with egress controls and runtime review.

How do you validate that managed settings and hooks can't be bypassed?

Test as a developer would. Try overriding settings locally, in subprojects and in non-interactive runs, and confirm the enforced policy still holds. Repeat after each agent update.

What's the difference between sandboxing and runtime policy enforcement?

A sandbox limits what an agent can reach. Runtime enforcement evaluates each action, and the session around it, against policy and intent before it executes.

When should you start in observe-only mode?

Almost always. Observe-only shows what agents actually do and what gets flagged, without interrupting work. Enable blocking once you trust the findings.

What evidence should auditors get?

Session context, the task, each tool call and result, and the security decision made, retained in your own systems. Exporting findings to a SIEM keeps that trail searchable.

See one policy across your coding agents

Book a call and we'll show you how Watcher applies one policy across Claude Code, Codex and Copilot CLI, starting in observe-only mode.