Vibe-Coded App Security Review: Keys, Auth, RLS & Limits
Security pass for apps built with AI coding agents: exposed API keys, browser-only logic, missing auth checks, Supabase RLS gaps, and missing rate limits.
Added · Updated
You are doing a security review of a web app I built mostly with AI coding agents. Review the code in this repo (or the files I paste). Don't change anything yet. Report first. Assume an attacker can read everything sent to the browser, call every API route directly, and change any request. Check each item below and give a pass, fail, or can't tell with the file and line. ## 1. Secrets - API keys, service-role keys, admin tokens, or webhook secrets in frontend code, public env vars (NEXT_PUBLIC_, VITE_, EXPO_PUBLIC_), the git history, or committed .env files. - Paid AI or payment API calls made straight from the browser instead of through the server. ## 2. Logic that only runs in the browser - Prices, credits, plan limits, roles, or "is admin" checks enforced only in the frontend. - Anything the server trusts from the client that it should compute or look up itself (user id, price, role, owner id). ## 3. Auth and ownership - API routes or server actions that don't check who is signed in. - Routes that check sign-in but not ownership, so one user can read, edit, or delete another user's records or shares by changing an id. - Admin pages that are hidden but not protected. ## 4. Database rules (Supabase, Firebase, or similar) - Tables with row level security (RLS) off, or policies like "true" for everyone. - Views or functions that bypass RLS (for example Postgres views not set to security_invoker, or security definer functions). - Storage buckets that are public when they shouldn't be. ## 5. Limits and abuse - No rate limiting on sign-up, login, password reset, AI endpoints, or anything that costs money. - No max length on prompts, uploads, or text fields sent to an AI model. - No spend cap or usage limit per user on paid APIs. ## 6. Input and output - User input put into SQL, shell commands, file paths, or HTML without escaping. - User text passed to an AI model with tool access, where it could inject instructions. - Error messages or logs that leak stack traces, keys, or other users' data. ## Report 1. A table of every fail: issue, file and line, how someone would exploit it in one sentence, severity (critical, high, medium, low). 2. The 3 fixes to make first, with the exact change for each. 3. Anything you couldn't check from the code (hosting settings, dashboard rules, env vars) and how I should check it. Then ask me before making any changes. Fix one issue per commit, and add a test that proves each fix works.
How to use it
- Click Copy template.
- Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
- Replace the [BRACKETED] parts with your details.
Pairs well with: AI Agent Guardrails Checklist: Prompt Rules vs. Tool Permissions
FAQ
Are vibe-coded apps secure?
Not by default. AI coding agents often put API keys in frontend code, enforce prices or roles only in the browser, and skip ownership checks on API routes. Run a security review before you launch or take payments.
How do I check if my API key is exposed?
Search your frontend code, public env vars (NEXT_PUBLIC_, VITE_), the built JavaScript, and your git history for the key. If it was ever exposed, rotate it with the provider, then move the call to the server.
Can a Supabase view bypass RLS?
Yes. By default a Postgres view runs with the permissions of its owner, so it can return rows that row level security would block. On Postgres 15 and later, set security_invoker on the view so it respects the caller's policies.
What should I fix first in a vibe-coded app?
Exposed secrets first (rotate them), then missing auth and ownership checks on API routes, then database rules, then rate limits and spend caps on anything that costs money.
Is a security review enough to call an app production-ready?
No. It closes the most dangerous holes, but a production app also needs tests, error handling, logging, backups with a tested restore, a runbook, and a named owner. Use the Graduate a Vibe-Coded Prototype prompt for that part.
Get 3 new templates every week
Free. Unsubscribe anytime.Related templates
AI Code Review Prompt
Vibe Coding Project Kickoff Prompt
Debug Any Error Prompt
Graduate a Vibe-Coded Prototype: Production Readiness Prompt
Browse all Coding & Cursor Rules templates