How to secure a Cursor app before the live site ships
Last updated · By Ember, SniffPup
Short answer: Cursor is an editor with an agent. Its own agent security docs describe guardrails that limit what that agent can do, and they say to keep the defaults enabled. Those controls do not check the site you deploy. How to secure a Cursor app is both: leave the editor approvals on, and then look at what the live URL sends to a stranger.
Check the live site: run a free SniffPup scan on the deployed URL. No signup. Full fixes free for every critical issue (no critical? one other fix is free).
A 100 means no issues were found in our checks. It is never proof of security.
How to secure Cursor
Work through the editor first, then the deployed app. The checklist version, including a comparison with Bugbot, is Is my Cursor app secure?. This page is the step order.
- Leave approval on for terminal commands, MCP connections, and MCP tool calls.
- Keep secrets out of the repo, out of chat pastes, and out of
NEXT_PUBLIC_andVITE_variables. - Read the diff before you merge, especially sign-in, payments, and data access.
- Scan the live URL for keys, public
.envor.gitfiles, source maps, and headers.
Cursor security settings to leave on
From Cursor's agent security page, checked November 10, 2026:
- Sensitive actions require manual approval by default. The docs say these controls are the defaults and recommend keeping them enabled.
- Reading files and searching code do not require approval. Use
.cursorignoreto block agent access to specific files. - The agent can modify workspace files without approval, except configuration files, and changes save immediately. The docs warn that auto-reload can run those changes before you review them. Use version control so you can revert.
- Terminal commands need approval by default. Run Modes, from an allowlist to the Auto-review classifier, are described as best-effort guardrails rather than a hard security boundary.
- Every MCP connection needs approval. After that, each tool call still needs approval unless you pre-approve it with an MCP allowlist.
- With default settings, agent network requests go to GitHub, direct link retrieval, and web search providers. The docs say agents cannot make arbitrary network requests with those defaults.
- Workspace trust is supported and disabled by default. To turn it on, set
security.workspace.trust.enabledtotruein user settings. Restricted mode breaks AI features. For a repo you do not trust, the docs say to use a basic text editor instead.
Report a product vulnerability to security-reports@cursor.com. Cursor says it acknowledges reports within 5 business days.
Keep secrets out of the agent and out of git
Cursor's ignore-file docs say .cursorignore blocks Agent, Tab, and @ mentions, that .env* and .git/ are on the default ignore list, and that files in .gitignore are ignored too. Two limits on the same page: the terminal and MCP tools the Agent uses cannot be blocked by .cursorignore, and complete protection isn't guaranteed because of LLM unpredictability. The longer version is Cursor .cursorignore for API keys and .env files.
How to check: confirm .env and .env.* are in .gitignore, then run git log --all -- .env. If a real key was committed or pasted into chat, create a new key, point the app at it, and revoke the old one. Deleting the line from the file does not revoke it. Steps for that are in I leaked an API key.
Keep secret keys out of the browser bundle
Next.js inlines NEXT_PUBLIC_ variables into the JavaScript visitors download. Vite does the same with VITE_. A Supabase anon or sb_publishable_ key, or a Stripe pk_ key, is meant to be public and still needs the provider's own rules (Row Level Security for Supabase). A service_role or sb_secret_ key, a Stripe sk_ key, or an AI provider key does not belong in that bundle. Put the call in server code and read the key from a server-only variable.
How to check: open the deployed site, DevTools, Sources, and search the bundles for service_role, sb_secret_, sk_live_, and PRIVATE KEY. The exposed API key guide lists more patterns. A free Cursor app scan runs the same outside check on a URL you own.
Review the diff, then the live site
Read changes that touch sign-in, payments, or who can read a row. Cursor's Bugbot reviews pull requests. It sees the diff, not the deployed response. After you ship, open the site signed out and try a URL that should require a login. Then sign in as a second user and change an id in the address bar. Both should be refused by the server or the database, not only by a hidden button.
Also request /.env and /.git/config on the live domain. File contents mean the file is public. A 404, or your normal page with no key material, is what you want. Full fixes free for every critical issue (no critical? one other fix is free).
Windsurf is a separate product. Its checklist is how to secure a Windsurf app. To run the scan from inside Cursor, see Use SniffPup inside Cursor.
FAQ
How do I secure Cursor?
Leave Cursor's default approvals on, keep secret files out of the repo and out of browser-bundled variables, review the diff before you ship, and check the live URL. Cursor's agent security docs say the controls are defaults and recommend keeping them enabled. They limit the agent. They do not inspect what your deployed site sends to visitors.
Does .cursorignore stop my .env file from reaching the internet?
No. Cursor's ignore-file docs say .cursorignore blocks Agent, Tab, and @ mentions from those paths, and that .env* is ignored by default. The same page says the terminal and MCP tools the Agent uses cannot be blocked by .cursorignore, and that complete protection isn't guaranteed. A committed or deployed .env is a separate problem: remove it from the site and rotate any real key.
Are Cursor Run Modes a hard boundary on terminal commands?
Cursor's agent security docs say terminal commands need your approval by default, and that Run Modes (an allowlist through the Auto-review classifier) are best-effort guardrails rather than a hard security boundary. Keep the default approval unless you have a reason to loosen it, and read any command the agent wants to run.
Does a clean SniffPup report mean nothing is left to check?
No. A score of 100 means no issues were found in our checks. It is never proof of security. SniffPup sees the public site, not your Cursor settings, your diffs, or anything behind a login. Full fixes free for every critical issue (no critical? one other fix is free).
Cursor facts checked November 10, 2026 on Cursor's agent security and ignore-file docs. A clean report is not a guarantee of security. Only scan sites you own.