// docs / security guides / v0 checklist
v0 security checklist: 22 items for Next.js
v0 generates React + Tailwind + shadcn/ui components and full Next.js apps for Vercel. This checklist targets v0-specific risks: design iterations that re-add dangerouslySetInnerHTML, exported codebases that lose middleware, Server Actions that skip auth verification, and environment variables that have to be set again once the code lives in your own repo. 22 items across secrets, database, auth, headers, deployment, and v0-specific gotchas.
PRE = pre-deploy (audit your source). DEPLOY = at deploy time. POST = post-deploy verification.
Secrets and API keys (4 items)
v0 handles env vars well in the editor but exported repos don't inherit that structure.
- PRE — After exporting, audit all
NEXT_PUBLIC_vars in the exported.env. Anything prefixedNEXT_PUBLIC_ships in the client bundle. Confirm they're safe (API endpoints, anon keys only, never service roles). - PRE — Verify
.env.local(or.env.*.local) is in.gitignore. When you export from v0, the exported repo should have.env*.localin.gitignore. Verify this. - PRE — Check that v0 didn't hardcode Stripe / Anthropic / OpenAI test keys. v0's exported code sometimes includes
sk_test_*orpk_test_*keys hardcoded in components. Replace with env vars before deploying to production. - POST — Run Secrets in JavaScript Bundles on the deployed Vercel Preview. If any key reached the bundle, the scan finds it.
Database access control (3 items)
v0's data fetching usually routes through Next.js Server Actions. The database connection itself is server-side, but RLS policies must be explicit.
- PRE — If using Supabase, enable RLS on every public table. v0 doesn't generate RLS by default. Add
ENABLE ROW LEVEL SECURITYto everyCREATE TABLEmigration. - PRE — Write explicit RLS policies per table and role. Each policy must validate user ownership via
auth.uid(). - POST — Run the Supabase Row-Level Security active check on a verified domain. The check confirms RLS enforcement.
Authentication and sessions (4 items)
v0 scaffolds auth but doesn't enforce server-side verification automatically.
- PRE — Ensure Server Actions use
getUser(), notgetSession(). Replace anygetSession()in Server Action functions withawait supabase.auth.getUser(). - PRE — Verify that magic-link tokens have server-enforced expiry. Default Supabase is 1 hour. If v0's generated code overrides it, revert to the default.
- PRE — Check the sign-in redirect guard. The
nextparam must start with/, never//. v0 usually includes this, but verify. - POST — Test logout clears the session. Sign in, sign out, inspect cookies (DevTools → Application → Cookies). The session cookie must be cleared.
HTTP headers and CSP (3 items)
v0's exported apps need middleware for CSP. The editor's internal CSP doesn't carry over.
- PRE — Create
src/middleware.tswith CSP if it doesn't exist. v0 sometimes exports without middleware. If missing, generate it with a nonce-based CSP. - PRE — Verify CSP includes
'strict-dynamic'and a per-request nonce. v0's CSP in the editor is safe but the exported version might be incomplete. - POST — Run HTTP Security Headers on a Vercel Preview. The scan reports missing headers and fix guidance.
Deployment hygiene (5 items)
v0 exports to your GitHub repo and you deploy to Vercel. Environment setup is your responsibility.
- DEPLOY — Verify
.env.localis in.gitignorein the exported repo. Rungit ls-files .env*to check. - DEPLOY — Set production env vars in Vercel Settings → Environment Variables. Scope each to Production only. Never share
sk_live_*with Preview. - DEPLOY — Audit Vercel build logs for secret echo. Check that no
echo $SECRETor equivalent is in your build command. - DEPLOY — Confirm Vercel Preview redeploys work correctly. Each Preview deployment should generate a fresh CSP nonce.
- POST — Rotate any test key that reached production. Even
sk_test_*keys should be rotated after production exposure.
v0-specific gotchas (3 items)
Patterns unique to v0's editor-to-repo export:
dangerouslySetInnerHTMLcan come back during design iterations. Review each exported version and replace any occurrences with sanitized alternatives (likereact-markdownwithremark).- Exported middleware is sometimes incomplete. v0's
src/middleware.tsexport might lack CSP or HSTS. Verify it's complete before deploying. - Server Actions don't automatically verify auth. v0 generates Server Actions without built-in auth checks. Add
const { user } = await supabase.auth.getUser()to every state-changing Server Action manually.
Next steps
Check the general vibe coding security checklist for 51 cross-tool items. Then review step-by-step hardening for deeper patterns on CSP, RLS, and Server Action security.
