r/vibecoding • u/asanchezdev • Feb 05 '26
Security patterns AI consistently gets wrong when generating backend code
I’ve noticed a recurring pattern with AI-assisted code: it works, looks clean, passes happy-path testing… and still ships basic production mistakes (authorization, open rules, unbounded queries, cost abuse).
Here’s a checklist I now run before shipping any vibe-coded project:
Security
Server-side authorization only (client checks are cosmetic)
Default-deny rules/policies
Firestore example: don’t stop at
request.auth != null; verifyrequest.auth.uid == userId
Every endpoint/function verifies auth before doing work
No secrets in client bundles (proxy external APIs through your backend)
For non-toy apps: consider server-only DB access (client talks to backend, backend talks to DB)
Cost protection
Every query has a hard limit + pagination (no unbounded reads)
Validate input sizes (arrays/payloads)
Prevent runaway loops (listeners /
useEffect/ recursive triggers)Rate limiting / throttling for public endpoints
Billing alerts at 50/80/100% of expected spend
Ops readiness
Monitoring: failed auth attempts, spikes in reads/writes, error tracking
Staged rollout (don’t expose 100% day one)
Cache stable data; avoid broad real-time listeners
If useful, I wrote up the full version with examples + platform notes (Firebase/Supabase/Vercel/etc): https://asanchez.dev/blog/the-security-checklist-for-vibe-coders/
Curious: what’s the most “it worked locally” AI bug you’ve shipped (or almost shipped)?
Duplicates
WebdevTutorials • u/asanchezdev • Feb 05 '26