Cursor & v0 Next.js Security Scanner
Shipped a Next.js app with Cursor or Vercel v0? Catch accidentally serialized __NEXT_DATA__ fields, NEXT_PUBLIC_* private keys, debug stack traces, public source maps, and missing headers in <15s.
01 · Exact Passive Checks
What LeakRay inspects on your live URL
| Rule ID & Check | What It Inspects | Why It's Passive & Safe |
|---|---|---|
nextjs-data-leak__NEXT_DATA__ & RSC Prop Serialization Leaks | Inspects serialized Next.js payloads for private fields such as passwordHash, refreshToken, apiSecret, serviceRoleKey, or databaseUrl accidentally passed from server to client. | Reads only the public HTML response already delivered to every browser visitor. |
secret-private-keysNEXT_PUBLIC_* Leaked Private Keys | Scans /_next/static/chunks/*.js for OpenAI, Anthropic, Stripe, AWS, GitHub, and Supabase service_role secrets accidentally prefixed with NEXT_PUBLIC_. | Filters out placeholders and public publishable keys, and automatically redacts matched secrets before storage. |
nextjs-debug-exposureNext.js Debug Stack Traces & Dev Artifacts | Checks rendered HTML and error payloads for webpack-internal paths, local server paths, and development mode indicators left enabled in production. | Passive GET inspection only—never fuzzes routes or triggers server errors. |
exposed-sourcemapsPublic /_next/static/*.js.map Source Maps | Verifies that productionBrowserSourceMaps is not publishing downloadable TypeScript source maps to public visitors. | Checks only sourceMappingURL pointers declared by your own public JS chunks. |
security-headers-coreVercel / Next.js Production Security Headers | Audits CSP, HSTS, X-Content-Type-Options, clickjacking protection, Referrer-Policy, and Permissions-Policy often omitted from fresh v0 or Cursor scaffolds. | Reads standard HTTP response headers from a single passive GET request. |
02 · Vulnerable vs. Fixed
Common production leak pattern and the exact fix
// Vulnerable: Full DB row passed to Client Component + NEXT_PUBLIC_ secret
// app/dashboard/page.tsx (Server Component)
export default async function DashboardPage() {
const user = await db.query.users.findFirst(); // Includes passwordHash & apiSecret
return <ProfileClient user={user} />; // Serialized verbatim to the browser!
}
// components/AiHelper.tsx ("use client")
const apiKey = process.env.NEXT_PUBLIC_ANTHROPIC_API_KEY; // CRITICAL LEAK// Fixed: Explicit field projection + server-only Route Handler
// app/dashboard/page.tsx (Server Component)
export default async function DashboardPage() {
const user = await db.query.users.findFirst({
columns: { id: true, name: true, avatarUrl: true },
});
return <ProfileClient user={user} />;
}
// app/api/ai/route.ts (Server-only: uses process.env.ANTHROPIC_API_KEY)
// Plus next.config.ts: poweredByHeader: false, productionBrowserSourceMaps: false03 · AI Fix Prompt
Paste into Cursor, Claude Code, Lovable, or Bolt
Audit and harden this Cursor / Vercel v0 Next.js application for production:
1. Search for all `NEXT_PUBLIC_*` env vars and move any private key (OpenAI, Anthropic, Stripe secret, Supabase `service_role`, DB URLs) into server-only Route Handlers or Server Actions.
2. Audit every Server Component passing props into `"use client"` components and every `getServerSideProps` loader to explicitly select only public UI fields (never pass raw Prisma/Drizzle user rows).
3. Update `next.config.ts` with `poweredByHeader: false`, `productionBrowserSourceMaps: false`, and baseline security headers (HSTS, CSP, `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `Referrer-Policy`, `Permissions-Policy`).
4. Run `npx leakray http://localhost:3000 --allow-local --fail-on high` against `next build && next start` to verify zero leaks.04 · Developer FAQ
Frequently asked questions
- Why do Cursor and v0 Next.js apps accidentally leak secrets or user fields?
- Two patterns show up repeatedly in fast AI iterations: prefixing an API key with NEXT_PUBLIC_ to silence an undefined error inside a Client Component, and passing a full ORM user object from a Server Component or getServerSideProps directly into client props.
- Can I paste LeakRay's fix prompts straight into Cursor Agent or Composer?
- Yes. Every LeakRay finding includes both a human code diff and a structured AI Fix Prompt designed to be pasted directly into Cursor, Claude Code, or v0—and you can also run npx leakray http://localhost:3000 --allow-local --ai-prompt right inside Cursor's terminal.
- Does LeakRay inspect Next.js App Router as well as Pages Router?
- Yes. LeakRay inspects live HTML, /_next/static/ JavaScript bundles, __NEXT_DATA__ payloads when present, source maps, Set-Cookie attributes, CORS behavior, and HTTP security headers across both App Router and Pages Router apps.
- Does Vercel automatically add CSP, HSTS, and clickjacking headers to v0 deploys?
- Vercel serves HTTPS automatically, but it does not inject a strict Content-Security-Policy, Permissions-Policy, or custom HSTS preload header for your app. Configuring headers() in next.config.ts or vercel.json closes those gaps cleanly.
More Passive Scanners
Explore related LeakRay checks
Supabase RLS & Key Exposure Checker
Passively scan your live app for leaked Supabase service_role keys, exposed PostgREST schemas, and missing RLS signals. Zero signup, <15s.
Open scanner Next.js · App Router & Pages Router · Passive AuditNext.js Production Security Scanner
Audit live Next.js apps for __NEXT_DATA__ secret leaks, debug stack traces, exposed source maps, .env files, and missing security headers.
Open scanner JS Bundles · Entropy + Context Validation · Passive AuditLeaked API Key & Frontend Secret Scanner
Scan your live HTML and JavaScript bundles for leaked Stripe, OpenAI, Anthropic, Gemini, AWS, and GitHub keys—without false-positive noise.
Open scanner Server Config · Dotfiles · Passive AuditExposed .env & .git File Checker
Check if your live website publicly exposes /.env, /.git/HEAD, or backup config files. Passive read-only URL scan with instant fixes. Zero signup.
Open scanner Firebase · Firestore · Passive AuditFirebase & Firestore Security Scanner
Passively audit live Firebase apps for leaked Admin SDK keys, exposed .env files, public source maps, and weak security headers without public apiKey noise.
Open scanner Cursor · Lovable · Bolt · v0 · Passive AuditSecurity Scanner for Vibe-Coded Apps
Free pre-launch security check for AI-built apps from Cursor, Claude Code, Lovable, Bolt, and v0. Catch leaked keys, open files, and missing headers.
Open scanner JavaScript Bundles · .js.map · Passive AuditProduction Source Map Exposure Checker
Check if your live Next.js, Vite, or React app publicly exposes .js.map source maps. Passive URL scan with framework-specific fixes and AI prompts.
Open scanner Headers · CORS · Cookies · Passive AuditHTTP Security Headers & CORS Checker
Check HSTS, CSP, SRI, COOP, CORS credential reflection, and cookie flags — plus JS secret & file checks that header-only scanners miss. Zero signup.
Open scanner Git Metadata · /.git/HEAD · Passive AuditExposed .git Directory & Config Checker
Check if your live site publicly serves /.git/HEAD or /.git/config before attackers dump source code and commit history. Passive URL scan, zero signup.
Open scanner CORS · Origin Reflection · Passive AuditCORS Misconfiguration & Reflection Checker
Test your live app for dangerous CORS origin reflection paired with Access-Control-Allow-Credentials: true. Passive read-only check with instant code fixes.
Open scanner GraphQL · __schema · Passive AuditGraphQL Introspection Exposure Checker
Verify whether /graphql or /api/graphql exposes your full __schema to unauthenticated callers in production. Read-only passive scan with Apollo & Yoga fixes.
Open scanner Set-Cookie · HttpOnly · Secure · SameSiteCookie Security Flags Checker
Audit Set-Cookie headers on your live app for missing HttpOnly, Secure, and SameSite flags on session and auth cookies. Zero signup, passive URL scan.
Open scanner Lovable · Supabase · Vite · Passive AuditLovable App Security & Supabase Scanner
Passive pre-launch security check for Lovable apps: catch leaked Supabase service_role keys, missing RLS signals, public source maps, and missing headers.
Open scanner Bolt.new · Vite · Client Bundles · Passive AuditBolt.new Security & Vite Bundle Scanner
Scan live Bolt.new and Vite apps for VITE_* client bundle leaks, exposed .env files, public .js.map source maps, and BaaS key misconfigurations in <15s.
Open scanner