⚡ PromptLoot

Home › Coding & Cursor Rules

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

  1. Click Copy template.
  2. Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
  3. Replace the [BRACKETED] parts with your details.

Pairs well with: AI Agent Guardrails Checklist: Prompt Rules vs. Tool Permissions

Sponsor this page · Reach builders who use AI daily. Get details

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

Get a senior-engineer style review of a diff or file.

Vibe Coding Project Kickoff Prompt

Turn a fuzzy app idea into a scoped plan before the AI writes any code.

Debug Any Error Prompt

Paste an error and get the root cause, a fix, and a way to prevent it.

Graduate a Vibe-Coded Prototype: Production Readiness Prompt

Turn a vibe-coded app or internal tool people now rely on into maintainable software: a spec from real behavior, tests, monitoring, backups, and an owner.

Browse all Coding & Cursor Rules templates

New on PromptLoot

2D Game Asset Rules for AI Agents: Sprites & Colliders

An ASSETS.md for Claude Code, Cursor, or Codex in Godot, Unity, Phaser, or Canvas: sprite sheet layout, naming, pixel-art import, animations, and colliders.

Agent Auto-Approve Policy: What AI Agents May Merge Alone

A policy file that sorts every PR an AI agent reviews into auto-merge, human review, or blocked: docs and tests yes; payments, auth, and secrets never.
PromptLoot Pro Pack · 200+ advanced templates, agent workflows, and Cursor rules bundles. Coming soon