Ship fast is good advice right up to the moment your app leaks its users’ data. I made a video on this, and here is the full checklist so you can run it without watching. Security researchers scanned over 5,000 vibe-coded apps and kept finding the same holes. The fix is one security pass, and most of it your agent can do if you ask.
Why AI writes insecure code
AI learned to code from tutorials, and tutorials hardcode keys, skip auth, and use wildcard permissions because that keeps the lesson simple. Your agent inherited those habits. It writes code that works, not code that is safe by default, and those are different skills. Worse, it also writes the tests, and the tests pass, because they check whether the app works, not whether it can be broken. The code and the tests share the same blind spots.
The breaches are real. Moltbook, built by a founder who wrote no code, left row-level security off on Supabase and exposed 1.5 million API tokens and 35,000 emails three days after launch. A dating safety app left a Firebase bucket with zero auth and exposed 72,000 images including 13,000 government IDs. A Lovable app had its auth logic backwards, blocking logged-in users and letting anonymous visitors in, exposing 18,000 users. RedHunt Labs scanned 130,000 vibe-coded sites and found one in five leaking a secret.
The eight holes, and their fixes
The video walks each one with the fix. Secrets in the code go in a .env file that is git-ignored, with GitLeaks as a pre-commit hook so a key can never be committed again. API keys in the frontend bundle move to a server-side route, so the browser calls your backend and never sees the key. Missing auth on some routes gets fixed with middleware at the router level, then you explicitly mark the public routes. IDOR, where changing /api/users/1 to /2 shows someone else’s data, needs one ownership check per endpoint that returns 403 if the user does not own the resource. An open database gets row-level security turned on with a policy that limits users to their own rows. No rate limiting invites the cost attack, where 10,000 requests in a minute can run up $40 or more in API charges, so you cap requests per IP with API Gateway, Express rate limit, or Cloudflare. SQL injection gets fixed with an ORM or parameterized queries. Frontend-only validation gets matched with backend schema validation using Pydantic or Zod.
The minimal pass before you deploy
The setup I recommend has five steps: install GitLeaks, add rate limiting, add backend validation, run a dual-agent check, and run OWASP ZAP against the deployed app. The dual-agent step is the big one. Send your code to a different AI than the one that wrote it, with this prompt: “You are a security auditor. Review this code for security vulnerabilities. Assume the developer made at least three mistakes. Find them.” The assume-three-mistakes line is what stops the model from replying “looks good,” because it is trained to agree with you. Go back and forth until both agents stop finding new issues.
The cost of skipping this is not theoretical. Mercor, a $10 billion AI startup, was breached through a supply chain attack that exposed 40,000 contractors’ data and drew six class-action lawsuits in a week. There is a free checklist at cloudyeti.io/vibe-security-checklist and a guardrails repo at github.com/ravsau/ai-tutorials/tree/main/vibe-coding-guardrails so you can run the same checks on your project.
Watch the full walkthrough above, then subscribe for more hands-on AI engineering. I specialize in security-reviewing AI-generated apps before they ship. Book a call at cloudyeti.io/meet.