r/vibecoding • • 2d ago

Showcase/Project I audited 4 official Next.js & FastAPI starter kits so you don't ship active CVEs — here's what I found

A lot of MVPs and AI-built apps start by cloning official templates, so I ran a multi-engine static audit (AST + OSV SCA + Git history + manual triage) on 4 of the most popular ones today:

• vercel/nextjs-subscription-payments — 1 Critical: Unauthenticated RCE in Next.js Image Optimization (GHSA-2464-fhr4-w9xw)

• vercel/ai-chatbot — 1 Critical + 3 High: Same Next.js RCE + ProseMirror XSS (CVE-2026-104847), KaTeX prototype pollution, Zod DoS

• nextjs/saas-starter — 3 High + 1 Med: Drizzle ORM SQL Injection (CVE-2026-39356), PostCSS arbitrary file read, Zod DoS, Next.js PPR memory exhaustion

• fastapi/full-stack-fastapi-template — 0 active CVEs (raw scanners threw 170+ alerts, mostly pytest asserts that we filtered out)

Full triaged table (zero scanner noise):

https://github.com/urriz065/Rehoboam-Security-Lab

Before you push your MVP to production, at least check your lockfile against OSV, verify you aren't shipping `.js.map` files or a `service_role` key in your `.next` client bundle, and make sure Supabase RLS is actually enforced. Happy to answer questions if anyone is unsure about their stack.

1 Upvotes

7 comments sorted by

1

u/ForgeRankAI 1d ago

the Next.js image RCE is worth pinning. the thing that actually bit us wasn't a CVE though, it was a table with RLS enabled and no policy written: the service key was the only thing that could read it, and we'd been shipping that key to the client for a week. a static audit can't see that.

1

u/bettt9 1d ago

Oof, shipping service_role to the client for a week is brutal — glad you caught it.

You're right that standard SAST/linters completely miss that combo, though it is catchable statically if you check two things together:

  1. Scanning the actual compiled .next/static bundle (not just src/) for NEXT_PUBLIC_ leaks or JWTs whose base64 payload decodes to "role":"service_role".
  2. Parsing the SQL migrations to flag tables with ENABLE ROW LEVEL SECURITY and zero CREATE POLICY statements — because that silent empty-result failure is usually what tempts an AI coding agent (or a tired dev) to reach for the service key just to make the query work.

Did it slip in through a NEXT_PUBLIC_ prefix or an accidental server-file import into a client component?

2

u/ForgeRankAI 1d ago

Yes,that is fair, and the static check is the one I skipped: grep every migration for

"enable row level security" and assert a "create policy" lands in the same file.

That catches the missing-policy case without ever connecting to the database.

What it does not catch is the policy that exists and is wrong. Ours was present and

still let a signed-in user read another tenant's row, because the policy compared the

wrong column. A lint sees that the policy exists; only a query sees the row come back.

The version that finally worked for me was running "select * from orders where

user_id = <someone else>" with the public key inside CI. It fails loudly, it takes a

second, and it does not need anyone to read the migration at all.

1

u/bettt9 1d ago

100% — a live cross-tenant CI test like that is honestly one of the highest-signal checks you can have.

The only annoying part is having to remember to write and maintain a negative test for every new table, role, and operation (SELECT/UPDATE/DELETE) as the schema grows.

That's actually the exact gap where formal verification (using an SMT solver like Z3) beats regex/linting: instead of just checking if a CREATE POLICY exists, you translate the USING / WITH CHECK predicate into constraints and ask the solver if role = authenticated AND auth.uid() = 2 AND row.user_id = 1 is satisfiable (SAT). If the policy compares the wrong column or just checks auth.uid() IS NOT NULL, Z3 hands you the exact cross-tenant counterexample in milliseconds — no live DB needed.

Combining that on PR diffs with your CI integration test pretty much closes the loop.

1

u/VridhiMehta 1d ago

people clone the official starter precisely because it feels like the safe default, which is why this audit was worth doing. the reply about RLS enabled with no policy written is the other classic, a locked door with no keyhole

1

u/bettt9 1d ago

"A locked door with no keyhole" is the best way I've heard it described.

And the worst part in vibe-coded apps is the chain reaction: RLS is on with no policy → the query silently returns [] → the AI agent "fixes" it by swapping in the service_role key → suddenly the entire database is wide open.

1

u/VridhiMehta 23h ago

ugh silent fails are the worst