Next.js Server Actions authentication check

Drop your Next.js app or paste a "use server" file to find server actions that never check who is calling.

Run the check

Drop a project folder or files here

node_modules, .git, virtualenvs and build folders are skipped. Limit 25 MB / 5,000 files.

The Python engine (Pyodide, a few MB, cached by your browser) loads when you start.

The mistake

Treating a server action as private because the page that renders the form is protected, and writing to the database without checking the session inside the action.

Why it is dangerous

Every exported function in a "use server" file (and every inline "use server" function) becomes a public POST endpoint. Next.js calls it with an action id that is in the page's JavaScript, so anyone can invoke it directly with any arguments, whether or not the page is protected. The arguments are client input, not trusted values.

How to fix it

Authenticate (and authorize) inside every action, like an API route:

"use server";
import { auth } from "@/auth";   // or Clerk auth() / getServerSession / supabase.auth.getUser()

export async function deletePost(id: string) {
  const session = await auth();
  if (!session?.user) throw new Error("Unauthorized");
  await prisma.post.delete({ where: { id, authorId: session.user.id } });
}

What this checker looks for

This page runs route-auth-check, which reads Next.js, Express, Fastify, Hono, FastAPI, Flask and Django routes. The rules most relevant to this page:

RuleWhat it finds
RAC003Server action has no authentication check
RAC002Record looked up by a request id with no ownership check (IDOR)
RAC006User id or role taken from the request instead of the session
RAC008Whole request body written to the database (mass assignment)

Every finding has a rule id, a severity, file:line, the offending line (secrets masked), why it matters and how to fix it. Run route-auth-check rules for the full list.

FAQ

Which auth helpers count as a check?

Common ones such as Auth.js auth(), getServerSession, Clerk auth() / currentUser, supabase.auth.getUser() and similar. The command-line tool also accepts --auth-fn for your own helper names.

Does protecting the page in middleware help?

Not for the action itself: the action id is in the page's JavaScript and can be called directly. Check the session inside the action.

Are my files uploaded anywhere?

No. The checker is Python running inside your browser tab (Pyodide, WebAssembly). Your files are read with the browser's File API and written into an in-memory file system that exists only in this tab. Your files are never sent anywhere. The only network requests load the Python runtime and the checker code, plus Google Analytics page-view counting, which never sees your files. You can disconnect from the internet after the engine has loaded and the scan still works.

Is a clean report a guarantee?

No. It is a static check for known patterns, not a penetration test. A clean report means none of these patterns were found, nothing more.

Can I run the same check on my machine or in CI?

Yes. Every checker on this site is an open-source command-line tool (MIT licence, Python 3.10+ standard library only). The results here are the same as `scan --json` on the command line, except for checks that need git (whether a file is committed or ignored), which cannot run in a browser.