The Production Vibe Coding Security Checklist
AI coding tools optimize for getting a demo working in 60 seconds, not locking down multi-tenant authorization, rate limits, or secret boundaries. This checklist covers the 12 failures that cause 90% of indie SaaS breaches.
When you prompt an LLM to 'add Stripe billing and user profiles with Supabase', it frequently skips Row Level Security, drops API keys into client bundles, omits webhook signature validation, and trusts client-supplied user_id fields.
- Anonymous scraping of entire user & lead tables via public Supabase anon keys
- Runaway OpenAI/Anthropic bills from unauthenticated or unthrottled AI endpoints
- Free lifetime Pro upgrades when clients tamper with Stripe checkout or subscription rows
Vulnerable Pattern vs. Production Fix
// app/api/projects/delete/route.ts — VULNERABLE (IDOR + no auth)
export async function POST(req: Request) {
const { projectId, userId } = await req.json();
await supabaseAdmin
.from("projects")
.delete()
.eq("id", projectId)
.eq("user_id", userId); // Attacker can pass ANY victim's userId!
return Response.json({ ok: true });
}// app/api/projects/delete/route.ts — SECURE
import { createServerSupabaseClient } from "@/lib/supabase/server";
export async function POST(req: Request) {
const supabase = await createServerSupabaseClient();
const { data: { user } } = await supabase.auth.getUser();
if (!user) return Response.json({ error: "Unauthorized" }, { status: 401 });
const { projectId } = (await req.json()) as { projectId?: string };
if (!projectId) return Response.json({ error: "Missing projectId" }, { status: 400 });
const { error } = await supabase
.from("projects")
.delete()
.eq("id", projectId)
.eq("user_id", user.id); // Server-verified identity + Postgres RLS
if (error) return Response.json({ error: error.message }, { status: 403 });
return Response.json({ ok: true });
}Copy-Paste AI Fix Prompt (Cursor · Lovable · Bolt · Claude Code)
Perform a full pre-launch vibe-coding security audit of this repository: 1. Check every API route, Server Action, and Edge Function: confirm authentication uses verified server sessions (never trusting userId/role from request bodies). 2. Search for NEXT_PUBLIC_ or VITE_ variables holding secret keys (Stripe, OpenAI, Supabase service_role, AWS) and move them to server-only code. 3. Verify every public Supabase table has ENABLE ROW LEVEL SECURITY and strict auth.uid() policies. 4. Confirm security headers (HSTS, CSP, X-Frame-Options, nosniff) and production sourcemaps=false are configured. Output a concise report of files changed and any keys I must rotate.
How to Verify Your Fix Worked
- 1Run VibeSecCheck against your deployed staging or production URL and confirm 0 critical issues.
- 2Inspect Network tab in an incognito browser to ensure zero secret keys or service_role JWTs appear.
- 3Open Supabase Dashboard -> Security Advisor and confirm zero 'RLS Disabled in Public' errors.
Frequently Asked Questions
What is the #1 security bug in vibe-coded apps?
Leaving Supabase Row Level Security (RLS) disabled on public tables while shipping the public anon key in the frontend, allowing anyone to read or modify every row with a single curl request.
Can I secure a Lovable or Bolt.new app without being a security engineer?
Yes. Focus on five concrete controls: keep secrets server-side, enable RLS with auth.uid() policies on every table, verify webhook signatures, rate-limit AI endpoints, and enforce baseline HTTP security headers.
How often should I re-run a vibe coding security check?
Run it before every production launch and after any major AI refactor — LLM edits frequently re-introduce permissive CORS, disabled RLS, or client-side env leaks.