A Cursor team on Auto-review allowlisted `npm`, and Agent ran `npm run db:reset` with no prompt — why did nothing stop it, and how should the team set Run Modes?
answer
- Approvals & Execution settings
- allowlisted calls skip the classifier
- prefix match: npm covers npm run
- narrow entries in permissions.json
- steering, not a security boundary
basics
~20 sUnder Cursor's Auto-review, an allowlisted command runs immediately, outside the sandbox and without the classifier, and the entry npm prefix-matches every npm command, including any script. Narrow the allowlist to exact commands and let everything else go to the sandbox and classifier.
solid answer
~40 sCursor's **Run Modes** (Settings > Agents > Approvals & Execution) are Auto-review, Allowlist and Run Everything. Auto-review checks each call in order: allowlisted calls run immediately and outside the sandbox, other shell commands run in the sandbox when they can, and the rest go to an LLM classifier. Terminal allowlist entries use **prefix matching**, so `npm` matched `npm run db:reset`, and an npm script runs whatever `package.json` says. The classifier never saw it. The fix is to replace broad entries with exact ones, such as `npm test` or `npm:install*`, in a committed `.cursor/permissions.json`, add a `block_instructions` sentence for database resets, and let team admins pin the baseline from the dashboard. Treat all of it as guardrails: Cursor says Auto-review is not a security boundary, and Run Everything removes even those.
code
json · 14 lines{
"terminalAllowlist": [
"npm test",
"npm:install*",
"git status",
"git diff"
],
"autoRun": {
"allow_instructions": [],
"block_instructions": [
"Every command that resets, drops or migrates a database should go through approval first."
]
}
}go deeper
Know the three Run Modes by name and where they are set: Settings > Agents > Approvals & Execution.
Explain Auto-review's order: allowlist first, outside the sandbox, then the sandbox, then the classifier, and that allowlist entries are prefixes.
Diagnose an unexpected unprompted command by tracing which step let it through, then fix it with narrow allowlist entries, block_instructions and a committed permissions.json.
Decide which modes a team may use and what the dashboard pins, accepting that Auto-review reduces prompts but is not containment.
## The three Run Modes **Run Modes** control how Cursor's local Agent runs **shell commands, MCP tools and Fetch calls**, and when it stops to ask you. They live in **Settings > Agents > Approvals & Execution**. | Mode | Runs without asking | Sandbox | Classifier | |---|---|---|---| | **Auto-review** | Allowlisted calls; other shell commands in the sandbox when possible; the rest if the classifier allows them | Yes, for shell commands | Yes | | **Allowlist** | Only what is on your allowlist; with sandboxing enabled, supported commands can run in the sandbox | Optional | No | | **Run Everything** | Every tool call | No | No | Auto-review shipped as the recommended default on May 29, 2026. The older **Ask Every Time** mode was deprecated a week earlier; its documented replacement is **Allowlist** with an empty allowlist. ## Why `npm run db:reset` ran unprompted Auto-review checks each call **in order**: 1. **Allowlisted?** Run it immediately, **outside the sandbox**, with no classifier review. 2. Otherwise, for a shell command: run it **in the sandbox** if it fits the sandbox's file and network limits. 3. Anything else, including a sandboxed command that failed on a restriction and is rerun outside, goes to the **classifier** on Cursor's backend, which can read files on your machine (for example the script a command runs) before it decides. Two facts combined: - **Terminal allowlist entries are prefixes.** The `permissions.json` reference says `git` matches `git status` (but not `gitk`), so `npm` matches `npm run anything`. Matching is case-sensitive. - **An npm script is arbitrary code.** `npm run db:reset` executes whatever the repository's `package.json` defines, with your full access. So step 1 fired and steps 2 and 3 never ran. Had `npm` not been allowlisted, the command would probably have been sandboxed; a reset against a local or remote database would likely have failed on the sandbox's network limits, and the rerun outside would have gone to the classifier. ## Setting it up properly - **Allowlist narrowly.** Use exact prefixes such as `npm test`, `git status` or the args-glob form `npm:install*`, never a bare tool name that can run scripts. - **Keep Auto-review** for everything else, so unknown commands are sandboxed or reviewed. - **Steer the classifier** with `autoRun.block_instructions`, plain-English sentences such as "every command that resets or drops a database should go through approval first". They are steering, not enforcement, and they have no effect in Allowlist or Run Everything. - **Commit** `<project>/.cursor/permissions.json` so the whole team gets the same entries. Per-user and per-repo arrays are concatenated, and a file-defined allowlist replaces the in-app one entirely. - **Pin the baseline centrally.** Team admins can restrict which modes are available and set allowlists in the web dashboard; admin settings beat `permissions.json`, which beats the IDE settings UI. - **Keep the other protections on.** File-Deletion Protection, External-File Protection and Browser Protection can still require approval when a mode would otherwise run a call. ## How the classifier behaves The Auto-review classifier runs on Cursor's backend on small Cursor-managed models. A few behaviours matter when a team relies on it: - **A block is not a dead end.** When the classifier blocks a call, the agent can try another approach; if it decides the action still makes sense, Cursor shows you an approval prompt. - **Model access controls reach it.** Enterprise model access controls apply to the classifier's models. Blocking the fallback model can disable Auto-review in Approvals & Execution, and members then use Allowlist instead. - **Configuration is optional.** Auto-review works without `permissions.json`; you can even ask Agent to write the `block_instructions` for you, and it edits the file. - **Edits apply live.** `permissions.json` is read at startup and re-read whenever it changes, and JSONC comments are allowed. ## What none of this guarantees Cursor's Run Modes page says it outright: **Auto-review is not a security boundary.** The classifier can allow a call you would have blocked. Allowlists are prefix lists, and Run Everything removes the checks entirely. Treat Run Modes as fewer surprises, not as containment; containment is a broader design question than this product's settings.
- The team wants Cursor to ask before every command, as the old Ask Every Time mode did. What is the current way?Ask Every Time was deprecated in Cursor 3.5 (May 22, 2026) and new users cannot choose it. The Run Modes page names the replacement: **Allowlist** with an empty allowlist. Keep in mind that with sandboxing enabled, Allowlist lets supported commands run in the sandbox.
- Does a `block_instructions` entry in Cursor's permissions.json guarantee a prompt before a database reset?No. `autoRun` instructions steer the Auto-review classifier; the reference calls them steering, not enforcement, and the classifier can make mistakes. They do nothing in Allowlist or Run Everything, and an allowlisted command never reaches the classifier at all, so the narrow allowlist does more of the work.
- A team admin set Run Mode controls in Cursor's dashboard, and a repository commits its own `.cursor/permissions.json`. Which wins?The admin. Allowlist precedence is team admin, then `permissions.json` (per-user and per-repo arrays concatenated), then the IDE settings UI; under admin controls neither file can add entries. For Auto-review guidance, a team configuration likewise makes Cursor ignore the user and project files.
- Auto-review sends every command, allowlisted or not, to the classifier
- An allowlist entry npm matches only the bare npm command
- Auto-review is a security boundary against a prompt-injected agent
- block_instructions in permissions.json hard-block the matching commands
- Run Everything still runs shell commands inside the sandbox
Assumes Cursor's docs as fetched on 2026-10-04: Auto-review shipped as the recommended default in Cursor 3.6 (May 29, 2026), and Ask Every Time was deprecated in 3.5 (May 22, 2026).