Scanora

Guides / Cursor

Securing a Cursor-built app - the 10 things AI misses

Cursor and other AI coding tools write working code fast, and often skip the boring security parts. Ten checks to run before you deploy an app you built with AI.

Updated 2026-11-18

Cursor, Claude Code, Windsurf and similar tools are excellent at producing code that works. They're less reliable at the parts nobody asked for: input validation, access checks, secret handling. If you prompted your way to a working app, these are the ten places to look before you deploy.

1. Secrets in frontend code

Search your frontend for API keys. Variables prefixed with VITE_, NEXT_PUBLIC_ or REACT_APP_ are shipped to every browser. Secret keys (AI providers, Stripe sk_, email services, database credentials) belong only in server code. See leaked API keys.

2. Secrets in git history

Deleting a key from a file doesn't remove it from git history. If a secret was ever committed, rotate it. Check that .env is in .gitignore.

3. Authorization, not just authentication

"Is the user logged in?" is authentication. "Is this user allowed to see this record?" is authorization. AI code often does the first and skips the second. Every endpoint that takes an ID should check the record belongs to the current user.

4. Database access rules

If the browser talks to Supabase or Firebase directly, the database rules are your security model. Check the Supabase RLS checklist or the Firebase rules checklist.

5. Input validation on the server

Validate input on the server (types, lengths, allowed values), even if the form already validates it. Use parameterised queries or an ORM. Never build SQL by joining strings.

6. Rate limits on expensive or sensitive endpoints

Login, sign-up, password reset, and any endpoint that calls a paid AI model should be rate limited. Otherwise one script can run up your bill or guess passwords.

7. CORS that isn't wide open

Access-Control-Allow-Origin: * together with cookies or tokens is a common AI shortcut to "fix CORS errors". Allow only the origins that need access.

8. Error messages and debug mode

Turn off debug mode in production. Error pages shouldn't show stack traces, SQL queries or file paths. Remove console.log lines that print tokens or personal data.

9. Dependencies

AI tools sometimes pin old library versions from their training data. Run npm audit (or your ecosystem's equivalent) and upgrade anything with known vulnerabilities, especially front-end libraries visitors download.

10. What's publicly reachable

Check that these aren't served by your web server:

  • .env, .git/, backups and database dumps
  • source maps (.js.map) in production
  • admin panels and test routes without login

And add basic security headers.

Prompts that work better

When you ask your AI tool to fix a security issue, be specific about the outcome and the limits, for example: "Move the OpenAI call to a server route that reads the key from an environment variable. Remove the key from all frontend code. Don't change the UI. Show me the diff."

Let a scan do the first pass

Scanora checks your deployed app for exposed keys, reachable sensitive files, source maps, missing headers, vulnerable front-end libraries, SSL and speed, and gives each finding a fix you can paste back into Cursor.

Check your site in one minute

Scanora runs these checks for you: leaked keys, open files, headers, SSL, speed and AI-search readiness. Free, no signup.

Scan my site free

More guides