01 Server secrets baked into the browser bundle
Why it happens. Framework prefixes such as NEXT_PUBLIC_, VITE_ and PUBLIC_ inline an environment variable into JavaScript shipped to every visitor. Coding assistants routinely add the prefix to stop an "undefined" error during a build.
Read-only check. Build the app locally and search both the environment files and the compiled static output for service-role keys, model API keys and billing secrets.
rg -n '(NEXT_PUBLIC|VITE|PUBLIC)_[A-Z0-9_]*(SECRET|SERVICE_ROLE|PRIVATE|API_KEY|OPENAI|ANTHROPIC|STRIPE_SK)' .
rg -n '(sk-ant-|sk-proj-|sk_live_|eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.*service_role)' .next/static dist build 2>/dev/null
Fix. Remove the public prefix, move the call into a server route or server function, and rotate every key that has ever appeared in a build or commit. Changing the variable name without rotating the key leaves the old key valid.
02 Database tables open to the public client key
Why it happens. Supabase, Firebase and PocketBase let the browser talk straight to the database with a public key, counting on row-level rules to enforce who may read or change each row. Generated schemas often create the table and skip the policy, or add a permissive policy (`using (true)`) to get the UI working.
Read-only check. On Postgres or Supabase, run a read-only query against catalog views to list tables in `public` without row-level security, and policies whose condition is literally `true`. On Firebase, read `firestore.rules` and `storage.rules`.
SELECT tablename, rowsecurity, forcerowsecurity
FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename;
SELECT tablename, policyname, cmd, roles, qual, with_check
FROM pg_policies WHERE schemaname = 'public';
Fix. Enable row-level security on every table exposed to PostgREST (`ALTER TABLE ... ENABLE ROW LEVEL SECURITY`), write separate SELECT, INSERT, UPDATE and DELETE policies tied to `auth.uid()` or the tenant membership table, and revoke grants that `anon` does not need.
03 Authorisation checked in the UI instead of the server handler
Why it happens. Hiding an admin button in React or checking the user in client state does nothing when someone calls the API route or Next.js Server Action directly. Assistants often trust a `userId` or `orgId` passed in the request body instead of reading it from the verified session.
Read-only check. List every route handler and `"use server"` file, then read each function from top to bottom: confirm it resolves the authenticated user from the server session and checks that user’s permission on the target record before touching the database.
rg -l '"use server"|\x27use server\x27' app src 2>/dev/null
rg -n 'export async function (GET|POST|PUT|PATCH|DELETE)' app src 2>/dev/null
Fix. Centralise session lookup in one server helper that throws when unauthenticated, derive the acting user and tenant on the server, never from request parameters, and Scope every query by that tenant ID.
04 Webhooks and callbacks accepted without verifying the signature
Why it happens. Stripe, GitHub, Clerk, Slack and Resend sign webhook deliveries so your server can tell a real event from a forged POST. Generated handlers frequently parse `await request.json()` first, breaking raw-body signature verification, or skip the check while testing and never put it back.
Read-only check. Find webhook routes and confirm each reads the raw request body (`await request.text()`), verifies the provider’s HMAC header against a secret from the environment, and records processed event IDs so replays are ignored.
rg -n 'webhook' app src pages 2>/dev/null
Fix. Read the raw body once, call the provider SDK’s verification function (`stripe.webhooks.constructEvent`, Svix `wh.verify`, or an HMAC comparison in constant time), reject on failure with HTTP 400, and make state changes idempotent on the event ID.
05 Model and paid API routes callable without login or spend caps
Why it happens. A `/api/chat` or `/api/generate` route added during prototyping often takes a prompt straight from the browser and forwards it to a paid model API with no session check, token ceiling or per-user rate limit.
Read-only check. Locate every import of an AI or paid third-party SDK and check the route that calls it for authentication, `max_tokens` (or equivalent), input length bounds and per-account rate limiting.
rg -n '(@anthropic-ai/sdk|openai|@ai-sdk/|replicate|elevenlabs)' app src pages server 2>/dev/null
Fix. Require an authenticated session (or a tightly scoped anonymous quota), cap input characters and `max_tokens` on the server, enforce a per-user and daily budget, and set a hard monthly spend limit in the provider console.
06 Agent tools able to act on untrusted text without confirmation
Why it happens. When an LLM reads untrusted text (an email, issue, webpage, uploaded file or database field written by another user) and has tools that send mail, run SQL, call internal APIs or edit files, instructions inside the data can steer those tools.
Read-only check. List every tool definition, MCP server and shell helper registered with the model. For each tool that writes state, sends data off-box or reads private records, trace whether untrusted content can enter the same context window.
rg -n '(tools\s*:|tool\(|mcpServers|inputSchema)' app src agent 2>/dev/null
Fix. Give read-only tasks read-only credentials, validate tool arguments in code against an allow-list (recipients, domains, file paths, SQL parameters), isolate untrusted retrieval from privileged tools, and require explicit human approval before any irreversible action.
07 Model output, Markdown or SVG rendered as live HTML, or redirects left open
Why it happens. Assistants reach for `dangerouslySetInnerHTML`, `{@html ...}`, unescaped Markdown renderers and `redirect(searchParams.next)` to ship formatting and login flows quickly. Any of those turns model output or user input into script execution or phishing redirects.
Read-only check. Search the codebase for raw HTML sinks, Markdown plugins configured with `html: true`, user-supplied SVG uploads served inline, and post-login redirect parameters that are not restricted to relative paths.
rg -n '(dangerouslySetInnerHTML|v-html|\{@html|innerHTML\s*=|rehype-raw)' app src components 2>/dev/null
rg -n '(redirect|router\.push)\s*\([^)]*(searchParams|query|next|returnTo)' app src 2>/dev/null
Fix. Render plain text by default; sanitise HTML through DOMPurify (or `rehype-sanitize`) with a strict schema; serve user uploads from a separate sandbox domain with `Content-Disposition: attachment`; and allow post-login redirects only to paths starting with a single `/` and not `//`.
08 Server-side URL fetches and file paths controlled by the caller
Why it happens. "Import from URL", link preview, PDF rendering and file-download features often pass a caller-supplied URL to `fetch()` or join a filename onto a local path. That can reach cloud metadata services (`169.254.169.254`), localhost admin ports or parent directories.
Read-only check. Find `fetch`, `axios` and filesystem calls whose target comes from request input rather than a constant.
rg -n 'fetch\s*\(\s*(req|request|body|params|url|input)' app src server 2>/dev/null
rg -n '(readFile|readFileSync|createReadStream|path\.join)\s*\(' app src server 2>/dev/null
Fix. Parse URLs, allow `https:` only, resolve DNS once and block RFC 1918, loopback, link-local and metadata ranges, and disable redirects (or re-check every hop). Store uploaded files under random server-generated keys rather than user filenames.
09 Secrets in git history, shipped source maps and leftover test routes
Why it happens. Deleting `.env` after an accidental commit leaves the keys in `git log`. Production builds may also publish `.map` files exposing the entire client source, or keep `/api/test`, `/api/seed` and verbose stack traces created during debugging.
Read-only check. Check git history for `.env` and key files, inspect build config for browser source maps, and list every route under `api/` or `app/` to spot debug and seed endpoints.
git log --all --full-history --stat -- '**/.env*' '**/*.pem' '**/serviceAccount*.json'
rg -n 'productionBrowserSourceMaps|sourcemap\s*:\s*true' next.config.* vite.config.* tsconfig.json 2>/dev/null
Fix. Rotate any secret that ever entered git (rewriting history alone is not enough once pushed), keep `.env*` in `.gitignore`, disable public production source maps, remove seed and debug routes, and return generic error messages to callers while logging details server-side.
10 Hallucinated packages, unpinned lockfiles and missing browser security headers
Why it happens. Models occasionally invent plausible package names or pull unmaintained libraries, and fresh deployments routinely ship without a Content Security Policy, framing protection or HSTS.
Read-only check. Verify a single lockfile is committed, check every recently added dependency on npm or PyPI for age, maintainer and download history, run a production vulnerability audit, and inspect live response headers.
npm audit --omit=dev
curl -sI https://example.com | rg -i '^(content-security-policy|strict-transport-security|x-frame-options|x-content-type-options|referrer-policy)'
Fix. Delete unused and suspect packages, install in CI with `npm ci` (never floating ranges), and set `Content-Security-Policy`, `Strict-Transport-Security`, `X-Content-Type-Options: nosniff`, `Referrer-Policy` and `Permissions-Policy` at the edge.
Local storage note. When JavaScript is enabled, your Pass / Needs fix / N/A ticks stay in your browser’s localStorage under one key (omvc-checklist-v1) and are never sent anywhere. Want a second pair of eyes on what turned up? Get in touch.