Blog

Vibe coding security checklist: what to check before you ship

An app built by prompting can work perfectly and still hand its database to anyone who opens the browser console. The agent did what you asked: the feature works. Nobody asked it to make the feature safe, and "works in the demo" is the only test most vibe-coded apps ever get.

This isn't a hypothetical. In 2025, CVE-2025-48757 described apps generated by Lovable whose Supabase tables could be read or written by unauthenticated visitors because row-level security was missing or too permissive; researchers reported more than 170 affected apps. Veracode's 2025 GenAI Code Security Report tested over 100 models on 80 coding tasks and found that they picked the insecure implementation in about 45% of cases. GitGuardian's State of Secrets Sprawl 2025 found a 6.4% secret-leak rate in public repositories using Copilot, against 4.6% across all public repositories.

None of the fixes below need a security team. Most are one command or one setting, and you can ask the agent to do them as long as you check the result yourself.

1. Keep secrets out of the code and out of the browser

The most common failure is also the simplest: an API key pasted into a source file, or a server-only key shipped in the frontend bundle.

  • Anything with a NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_ prefix is public. Build tools inline these into the JavaScript every visitor downloads. A Stripe secret key, an OpenAI key or a Supabase service_role key must never carry one of those prefixes.
  • Put real values in .env and commit .env.example. Check .gitignore before the first commit, not after. Removing a key in a later commit leaves it in the history.
  • Scan the whole history, not just the working tree. TruffleHog can check every commit and report only keys that still work:
trufflehog git file://. --only-verified
  • If a key leaked, rotate it first. Deleting the commit doesn't help once the repo was public or the key reached a log. Revoke, create a new key, then clean up.
  • Stop the agent from reading secrets at all. In Claude Code, a deny rule in .claude/settings.json keeps .env out of its context:
{
  "permissions": {
    "deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)"]
  }
}

2. Treat the database as public unless a policy says otherwise

Backend-as-a-service platforms such as Supabase and Firebase let the browser talk to the database directly. That's convenient, and it means the public key in your frontend can query every table that isn't protected by a policy. The key is meant to be public; the policies are the security.

For Supabase, list which tables in the exposed public schema have row-level security turned off:

select tablename, rowsecurity
from pg_tables
where schemaname = 'public';

Every row should say true. Then check what the policies actually allow. A policy with using (true) is the same as no policy for that operation. A typical owner-only policy looks like this:

alter table profiles enable row level security;

create policy "Users read their own profile"
on profiles for select
using (auth.uid() = user_id);

Then test it the way an attacker would: with only the public key, from outside the app.

curl "https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*" \
  -H "apikey: $SUPABASE_ANON_KEY"

If that returns other users' rows, the app is leaking. Firebase has the same trap: rules like allow read, write: if true; are fine in a five-minute prototype and a breach in production.

3. Check authorization on the server, for every request

Agents are good at building a login page and bad at remembering that hiding a button isn't access control. Look for these patterns:

  • IDs from the client trusted as-is. GET /api/orders/123 must check that order 123 belongs to the signed-in user. Changing the number in the URL is the first thing anyone tries.
  • Role checks only in the UI. If the admin page is hidden in React but /api/admin/users answers anyone with a session, it isn't protected.
  • User IDs taken from the request body. The server should read the user from the verified session or token, never from a userId field the client sends.

A quick test: sign in as two users in two browsers, copy a request from one into the other with the browser's dev tools, and see what comes back.

4. Verify every package the agent installs

Models invent package names. The study We Have a Package for You! generated 576,000 code samples with 16 models and found 205,474 unique package names that don't exist, with average hallucination rates of at least 5.2% for commercial models and 21.7% for open-source ones. Attackers register those names and wait; the practice is called slopsquatting.

Before you accept a new dependency:

  • Check that it exists and has a history. A package created last week with no repository link and one maintainer deserves a closer look.
npm view some-package time.created repository.url maintainers

For Python, open https://pypi.org/project/some-package/ and look at the release history and project links.

  • Commit the lockfile (package-lock.json, pnpm-lock.yaml, uv.lock, poetry.lock) and install with npm ci in CI so builds don't pick up new versions silently.
  • Run the audit tools and read what they report instead of piping them to --fix blindly:
npm audit
pip-audit

5. Validate input and encode output

Veracode reported that models failed to prevent cross-site scripting in 86% of the relevant samples. The fixes are old and boring, which is why they get skipped:

  • Use parameterized queries or the ORM's query builder. Search the code for SQL assembled with template strings or +.
  • Don't render user content as HTML. In React, every dangerouslySetInnerHTML needs a reason and a sanitizer such as DOMPurify. The same goes for v-html in Vue and innerHTML in plain JavaScript.
  • Validate request bodies at the edge with a schema library (Zod, Valibot, Pydantic) so unexpected fields and types are rejected before they reach your logic.
  • Check file uploads for size and type on the server, and never build a file path from a user-supplied name.

6. Turn off the demo settings

Prototypes collect settings that are fine on localhost and dangerous on the internet:

  • Debug mode and verbose error pages that print stack traces, SQL or environment variables.
  • CORS set to * with credentials allowed.
  • Seed accounts like [email protected] with a known password.
  • Admin or test routes that nobody removed.
  • No rate limit on login, signup, password reset or any endpoint that calls a paid API. Without one, a script can run up your model bill overnight.

7. Limit what an AI feature can spend and see

If your app calls a model API, the key behind it is a credit card. Keep it on the server, give each environment its own key, and set limits where the provider supports them.

On ChromaLab, each key can carry an expiry date, a model allow or block list, and a daily token budget, all enforced before the request is sent upstream. A leaked or runaway key then fails with token_budget_exceeded instead of draining the plan. See per-key controls in the docs.

Let the agent review its own work, then check it yourself

Agents find many of these issues when you ask directly, so ask after each feature, not once before launch. A prompt that works:

Review the changes on this branch for security problems only.
Check: secrets in code or client bundles, database tables without
row-level security, endpoints that skip authorization or trust IDs
from the client, unparameterized SQL, unsanitized HTML rendering,
new dependencies (confirm each exists and say why it's needed),
and debug or permissive CORS settings. List each finding with the
file and line. Don't change any code yet.

Claude Code also ships a /security-review command that does a similar pass on pending changes. Treat the output as a list of leads to verify. The curl test in section 2 and the two-browser test in section 3 tell you more than any review, because they test what's deployed rather than what the code appears to do.

Checklist

  • No secrets in the repo or its history; nothing secret behind a NEXT_PUBLIC_ or VITE_ prefix.
  • Leaked keys rotated, not just deleted.
  • Row-level security on every exposed table, with no using (true) policies, tested with only the public key.
  • Authorization checked on the server for every request, with the user taken from the session.
  • Every new package verified to exist and to be the one you meant; lockfile committed; npm audit or pip-audit clean or understood.
  • Parameterized queries, no unsanitized HTML, request bodies validated.
  • Debug mode off, CORS restricted, seed accounts and test routes removed, rate limits on auth and paid endpoints.
  • Model API keys on the server only, one per environment, with budgets.