Cursor Security Review: A Checklist for AI-Assisted Code

By Alvi Lika, Founder, Soatech

· · 12 min read

What to check before Cursor-assisted code ships: agent settings and sandbox, the repository's rules files, dependencies, authorization, secrets and webhooks.

Cursor does not decide whether your application is safe to release. It is an editor with an agent that reads, writes and runs things on your behalf. What you release depends on the code that ends up in the repository and on how carefully it was reviewed. A disciplined team can ship sound software with Cursor. A team that merges whatever the agent produced can ship a cross-account data leak just as quickly.

A security review of Cursor-assisted work therefore covers two separate things:

  1. The agent's environment. What the agent can read, write, run and connect to on a developer's machine, and what instructions it picks up from the repository.
  2. The application code. The same questions you would ask of any code, aimed at the mistakes that turn up most often when nobody checks generated changes.

The checklist below follows that split. Each item says what to check and how to check it. Run the commands against your own repository and your own staging environment only.

If you meant Cursor's own Security Review

"Cursor Security Review" is also the name of a product feature. Cursor's Security Agents come in two types: Security Review, which checks pull requests before they merge, and Vulnerability Remediation, which scans the codebase on a schedule and can open draft fix pull requests for confirmed findings. Both run on Cursor's Cloud Agents and Automations, usage is billed to the team, and a /review-security skill (Cursor 3.7 and later) reviews your branch before you push. Cursor's documentation is explicit that it never merges a fix for you.

Turn it on if your plan includes it: an automated reviewer on every pull request catches issues a tired human misses. What it cannot know is your product's rules — which customer may see which records, which actions need an owner, what a payment event is allowed to change. The checklist below covers the agent's own environment, which a pull-request reviewer does not see, and the application decisions that only your team can confirm.

Part 1: the agent's environment

1. Cursor is on a patched version

CVE-2026-26268 ("Sandbox escape via Git hooks", published 13 February 2026, rated High) affected Cursor versions before 2.5. A sandboxed agent could write to insufficiently protected .git configuration, including Git hooks. Those hooks then ran outside the sandbox the next time Git triggered them. The trigger was a manipulated agent, for example one following instructions planted in content it had read. The fix shipped in 2.5.

Check: the version in Cursor's About dialog is 2.5 or later on every machine that works on the codebase. Watch Cursor's security advisories for newer issues.

This CVE is a fair example of the wider risk. An agent that reads untrusted text and can also write files and run commands has a larger attack surface than an editor that only completes code.

2. The run mode matches how much you trust the repository

Cursor's run modes live under Settings → Agents → Approvals & Execution:

  • Auto-review (the recommended default). Allowlisted calls run immediately and a classifier reviews the rest.
  • Allowlist. Only listed actions run without approval.
  • Run Everything. Every tool call runs automatically, with no sandbox and no classifier.

Cursor states that Auto-review "is not a security boundary" and that its classifier can make mistakes. Where the sandbox is supported (macOS with Cursor 2.0 or later; Linux with Landlock-capable kernels), sandboxed shell commands get workspace access, protected paths such as .git/config and .git/hooks are shielded, and network access is blocked unless you open it.

Check: nobody runs Run Everything on a repository they did not write. Keep allowlists short and specific. An allowlisted npm run or make executes whatever the repository's scripts say.

3. Untrusted repositories are opened deliberately

Workspace Trust is disabled by default in Cursor. You can turn it on with "security.workspace.trust.enabled": true in your user settings.json, and organisations can enforce it. In restricted mode Cursor turns off its AI features, so for a repository you do not trust, the docs recommend a plain text editor instead.

Check: before running the agent on a cloned third-party project, read it in an editor without the agent, or work in a disposable VM or container that holds no credentials.

4. Rules and agent instruction files are reviewed like code

The agent follows written instructions from the repository. Current Cursor project rules are .mdc files in .cursor/rules/. AGENTS.md files in the project root and subfolders also apply. Older repositories may still have a .cursorrules file. Team rules and user rules are configured outside the repository.

Instructions in these files can push the agent toward unsafe changes. Text can also be hidden from a human reviewer using invisible or bidirectional Unicode characters, the class of problem described by Trojan Source (CVE-2021-42574).

Check: list every instruction file in the repository, read each one, and look for hidden characters:

# Every file that can instruct the agent
git ls-files | grep -E '(^|/)(AGENTS\.md|\.cursorrules)$|^\.cursor/'

# Zero-width and bidirectional control characters (works with macOS and Linux perl)
git ls-files -z | xargs -0 perl -CSD -ne \
  'print "$ARGV:$.\n" if /[\x{200B}-\x{200F}\x{202A}-\x{202E}\x{2066}-\x{2069}\x{FEFF}]/; close ARGV if eof'

Treat changes to these files as code changes that need review, especially when they come from a pull request.

5. MCP servers are limited to ones you would trust with a terminal

Cursor asks for approval for each MCP connection, and for each tool call unless you pre-approve it through an MCP allowlist. An MCP server works with the permissions of the credentials you give it. Project-level MCP configuration under .cursor/ is picked up by the file list in check 4.

Check: every configured server has a named owner, a reason to exist and the narrowest credentials that work. Do not allowlist tools that write to production systems.

6. Secrets are out of the agent's reach

The agent can read workspace files without approval. .cursorignore blocks agent access to listed files. That keeps .env files out of context, but it does not make a developer laptop a safe place for production credentials.

Check: .env* and key files are listed in .cursorignore and .gitignore. Production secrets live in the hosting platform's secret store, not on machines that run an agent.

7. Privacy Mode is set according to your obligations

Privacy Mode controls whether your code and prompts can be used for training and retained by model providers. Cursor describes zero-data-retention agreements with its providers when it is on, with limited exceptions for abuse detection. Privacy Mode is a data-handling control. It does not scan, review or harden the code the agent writes.

Check: Privacy Mode is on where your contracts or data require it, and the team setting is enforced by an admin rather than left to individuals.

Part 2: the application code

8. Every agent change is reviewed as a diff before it is committed

Cursor saves agent edits to disk immediately. Commit before an agent session, then review git diff before committing what the agent changed. Small, single-purpose changes are much easier to review than a large multi-file rewrite.

Check: no direct pushes to the main branch, a second person (or a second pass by the author on a later day) reviews each pull request, and the pull request says what was generated.

9. Every new dependency exists and is the package you intended

Models sometimes recommend packages that do not exist. A USENIX Security 2025 study of 16 code-generating models found that, on average, at least 5.2% of packages suggested by commercial models and 21.7% of those suggested by open-source models were hallucinated (Spracklen et al.). An attacker who registers one of those names gets their code installed. The attack is often called slopsquatting.

Check: for every package added in the diff, confirm it on the registry (publisher, repository link, release history) before installing. Commit the lockfile and run an audit in CI:

# Packages added or changed on this branch
git diff main -- package.json

# Fail the build on high or critical advisories in production dependencies
npm audit --omit=dev --audit-level=high

10. Authorization is checked where the data is read

This is the most important item, and a demo cannot catch it. A route that checks "is someone signed in" but not "does this record belong to them" works perfectly for the owner. It also works for every other signed-in user who guesses or copies an ID.

A simplified Next.js 16 route handler with the check in the query:

// app/api/projects/[id]/route.ts (simplified)
import { getSession } from "@/lib/auth"; // your auth helper
import { sql } from "@/lib/db";          // a tagged-template client that parameterizes values

export async function GET(
  _req: Request,
  { params }: { params: Promise<{ id: string }> },
) {
  const session = await getSession();
  if (!session) return Response.json({ error: "Unauthorized" }, { status: 401 });

  const { id } = await params;
  const rows = await sql`
    select id, name, updated_at
    from projects
    where id = ${id} and account_id = ${session.accountId}
  `;

  // Not found, rather than forbidden: don't confirm that another account's record exists.
  if (rows.length === 0) return Response.json({ error: "Not found" }, { status: 404 });
  return Response.json(rows[0]);
}

Check: create two test accounts in staging. As account A, create a record and note its ID. Then request it with account B's session:

curl -s -o /dev/null -w "%{http_code}\n" \
  -H "Cookie: $ACCOUNT_B_SESSION_COOKIE" \
  "https://staging.your-app.example/api/projects/$ID_OWNED_BY_A"
# Expect 404 or 403. A 200 is a cross-account leak.

Repeat for writes, deletes, exports, search and file downloads, not just the list page. If the data lives in Supabase, the same test applies at the database layer; testing Supabase RLS with two accounts covers the policies, grants and roles that bypass them. In Next.js, Server Actions and Route Handlers are public endpoints. The framework's authentication guide recommends checks close to the data source rather than in proxy.ts (formerly middleware.ts) alone.

11. Input is validated on the server and queries are parameterized

Check: request bodies are parsed against a schema on the server (Zod, Valibot or similar), and no SQL is built by string concatenation:

# Template-literal SQL with interpolation, but not tagged templates like sql`...`
git grep -niE '(query|execute|raw)\([[:space:]]*`[^`]*(select|insert|update|delete)[^`]*\$\{' -- '*.ts' '*.tsx' '*.js'

A match is a lead to inspect, not proof of a vulnerability. A clean result does not prove the absence of one either.

12. No secrets in the repository or the client bundle

Check: run a secret scanner (for example gitleaks or your Git host's secret scanning) over the full history, and grep for common key prefixes as a quick first pass:

git grep -nE 'sk_live_|sk_test_|AKIA[0-9A-Z]{16}|ghp_[A-Za-z0-9]{36}|-----BEGIN [A-Z ]*PRIVATE KEY-----'

In Next.js, anything prefixed NEXT_PUBLIC_ is compiled into browser JavaScript. Review that list by name. A key that has ever been committed should be rotated, not just deleted.

13. Webhooks verify signatures and tolerate duplicates

An endpoint that parses any JSON posted to it will accept forged events. Stripe requires the raw request body for signature verification, and it notes that an endpoint "might occasionally receive the same event more than once":

// app/api/webhooks/stripe/route.ts (simplified)
import Stripe from "stripe";

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

export async function POST(req: Request) {
  const signature = req.headers.get("stripe-signature");
  if (!signature) return new Response("Missing signature", { status: 400 });

  const body = await req.text(); // the raw body, before any JSON parsing
  let event: Stripe.Event;
  try {
    event = stripe.webhooks.constructEvent(body, signature, process.env.STRIPE_WEBHOOK_SECRET!);
  } catch {
    return new Response("Invalid signature", { status: 400 });
  }

  // Record event.id in a table with a unique constraint before acting on it.
  // If the insert conflicts, the event was already handled: return 200 and stop.

  return new Response(null, { status: 200 });
}

Check: a POST with a made-up body and no valid signature returns 400. Replaying the same event twice (for example with stripe events resend) produces one side effect, not two.

14. Errors do not leak internals

Check: API error responses contain a generic message and, ideally, a request ID. Stack traces, SQL and file paths go to your logs only. Trigger a failure in staging and read the response body.

15. Sign-in, reset and expensive endpoints are rate limited

Brute-force attempts and runaway costs from AI endpoints have the same fix. Limit requests per account and per client, and return 429 when the limit is exceeded. If your auth provider already rate-limits its own endpoints, confirm the setting rather than adding a second limiter. Note that request.ip was removed from NextRequest in Next.js 15. Generated code that still uses it is stale.

Check: a scripted burst against your own staging sign-in endpoint starts returning 429, and the password-reset response is the same whether or not the email exists.

16. The framework is on a patched release

Framework vulnerabilities are separate from anything the agent wrote. For Next.js, the November 2026 security release (3 November 2026) shipped fixes in 16.4.5 and 15.5.29. Check the Next.js blog for anything newer before you release.

Check: npm ls next react react-dom shows patched versions, and a process exists for applying security releases within days, not months.

What this checklist does not cover

These checks find common, preventable problems. They are not a penetration test, a threat model or a review of your business logic. They also cannot tell you whether a feature is allowed to do what it does. A model that can send documents or move money needs controls that no generic list can define for you; treating model output as a proposal rather than an instruction is a starting point.

If the two-account test fails, or you are not sure which of these items apply to your codebase, a written diagnosis is a sensible next step before more code is written.

Want these checks run against your codebase and ranked by severity?

See the Production Audit

Working on a feature this article touches? A 30-minute call is the quickest way to scope it.

Discuss your project