nextjs-vercel-security

nextjs-vercel-security is a cursor rule for Cursor from coldtatooine/vuln-skill-pack. It costs 0 tokens per session (583 once invoked), scanned B, original, MIT.

A security checklist for Next.js and Vercel applications. It covers exposing secrets in browser code, protecting server actions and API routes, avoiding authentication bypasses, and handling server-side requests safely.

In plain words
What is it for?
Reviewing Next.js and Vercel code for secret leaks, missing authentication or authorization, insecure request handling, and access-control mistakes.
Why use it?
These frameworks do not automatically protect every server endpoint, and public environment variables or unchecked IDs can expose secrets or data.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/coldtatooine/vuln-skill-pack/nextjs-vercel-security
Clone the repo
git clone --depth 1 https://github.com/coldtatooine/vuln-skill-pack

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for nextjs-vercel-security

README.md
[![agentmods](https://agentmods.dev/badge/rules/coldtatooine/vuln-skill-pack/nextjs-vercel-security.svg)](https://agentmods.dev/rules/coldtatooine/vuln-skill-pack/nextjs-vercel-security)
Your own site
<a href="https://agentmods.dev/rules/coldtatooine/vuln-skill-pack/nextjs-vercel-security"><img src="https://agentmods.dev/badge/rules/coldtatooine/vuln-skill-pack/nextjs-vercel-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 583 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00583
Opus 5 $0.00000 $0.00292
Sonnet 5 $0.00000 $0.00117
Haiku 4.5 $0.00000 $0.00058

Measured 6d ago against content hash 0e987f2df7c0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade B, and why

nextjs-vercel-security scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Cloud metadata endpointmediumServer-side request forgery

One request to 169.254.169.254 can return temporary IAM credentials.

- Server-side `fetch()` with a user-supplied URL → SSRF into internal services / cloud metadata (`169.254.169.254`). Allowlist hosts.

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

cursor/rules/nextjs-vercel-security.mdc · 35 lines

How it starts

The opening of the file, as written. The whole thing — 35 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Next.js & Vercel Security Footguns

1. Secret leakage across the client/server boundary

  • NEXT_PUBLIC_* is public — inlined into the browser bundle. A real secret here is leaked. Only publishable/anon keys belong there.
  • Server-only secrets must never be imported into a Client Component. A module imported by a "use client" file (directly or transitively) ships to the browser. Check import chains, not just the file. Use import 'server-only' to fail the build if server code reaches the client.
  • Supabase service_role, Stripe sk_*, DB URLs → server only.

2. Server Actions

  • Every Server Action is a public POST endpoint. No auth is applied automatically. Each must independently verify session AND authorization — do not assume it's only callable from your UI.
  • Validate and authorize arguments. Args are attacker-controlled. Re-check ownership/tenant on every ID passed in. Don't trust hidden form fields.

3. Route Handlers (route.ts) & API routes

  • No built-in auth — each handler checks session + role itself.
  • IDOR: /api/orders/[id] must verify the caller owns the order, not just that they're logged in.
  • Validate body/params before use; don't reflect errors verbatim.

4. Middleware auth bypass

  • middleware.ts matcher gaps let routes slip past auth. Verify the matcher covers every protected path (nested routes, /api, static).
  • Middleware is a filter, not the gate — re-enforce authz at the data layer. Never rely solely on a cookie's presence; verify the session/token signature.

5. SSRF & untrusted fetches

  • Server-side fetch() with a user-supplied URL → SSRF into internal services / cloud metadata (169.254.169.254). Allowlist hosts.
  • Image Optimization remotePatterns/domains too broad can proxy arbitrary hosts.

6. Other

  • Open redirect: redirect(userInput) / ?next= without validating it's a same-origin relative path.
  • dangerouslySetInnerHTML: XSS if fed unsanitized input.
  • Caching: don't cache authenticated responses at the CDN/edge where another user could receive them.

Read the full file on GitHub · 35 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 35 lines · 0 tokens per session scan B 0e987f2df7c0

Subscribe to this mod's changes

nextjs-vercel-security is a cursor rule published in the GitHub repository coldtatooine/vuln-skill-pack (2 stars, last pushed 11d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 583 tokens. A static security scan graded it B with 1 finding (cloud metadata endpoint). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.