AI writes code fast. It doesn't always write it safe.
42% of AI-generated code contains vulnerabilities (Stanford/McKinsey, 2025). If you're building with Cursor, Windsurf, Bolt, or any AI coding tool, you need to know what to check.
The fix: Use environment variables. Every framework supports them.
.env file for your keys.env to your .gitignore (so it never hits GitHub)process.env.MY_API_KEYCheck right now: Search your codebase for any string that looks like sk-, pk_, or Bearer. If you find them in code files (not .env), move them immediately.
AI builds forms that accept whatever users type. That means SQL injection, XSS attacks, and data corruption.
The fix: Tell your AI tool: "Add input validation and sanitization to all user inputs." Then verify it actually did it.
AI will build a login system that "works" but stores passwords in plain text, doesn't rate-limit login attempts, or uses weak session tokens.
The fix: Don't build auth yourself. Use a service:
When your API doesn't work from the frontend, the AI's first instinct is to set Access-Control-Allow-Origin: *. This means any website in the world can call your API.
The fix: Set CORS to only allow your own domain:
Access-Control-Allow-Origin: https://yourdomain.com
Without rate limiting, anyone can hit your API thousands of times per second. This means:
The fix: Add rate limiting from day one. Most frameworks have middleware for this. Even a simple "100 requests per minute per IP" stops 90% of abuse.
Before you deploy anything, check these 5 things:
If all 5 pass, you're ahead of 80% of vibe-coded apps.