- Home
- Skills
- Code Quality & Review
- nextjs auth rbac reviewer
More screenshots
Works with the AI Agents you already use
nextjs auth rbac reviewer
Review Next.js App Router server actions and route handlers for RBAC gaps, tenant leaks, and IDOR vulnerabilities.
Free
nextjs auth rbac reviewer
Example session with this skill installed
Use nextjs-auth-rbac-reviewer on app/actions/applications.ts.
Users sign in with Google. Each user may only view and change their own
internship applications. Read-only review please.
- Read your context and instructions
- Compiled the nextjs auth rbac
Synthetic example. Illustrative of the output format. It is not from a
real project and not a recorded agent session.
A. Scope and limitations
- Reviewed:
app/actions/applications.ts,lib/auth.ts,lib/db.ts - Next.js version: not determinable from supplied files. Auth: Google OAuth
via agetSession()helper - Access model: stated by user (own applications only; no admin role)
- No commands run. Nothing executed or tested.
B. Authorization-boundary summary
| Entry point | Auth check | Role check | Ownership check |
|---|---|---|---|
moveApplication (server action) | Yes (getSession) | n/a | No |
listApplications (server action) | Yes | n/a | Yes (where: { userId }) |
C. Findings
F-1: Any signed-in user can change another user's application status
- Severity: High. A signed-in user who obtains or guesses another
application's id could alter that user's records. - Confidence: High
- Location:
app/actions/applications.ts, lines 9–11,moveApplication - Evidence: the Zod schema validates that
statusis an allowed value,
which checks shape, not authority.getSession()(read inlib/auth.ts)
returns identity only.db.application.updatefilters byidalone. No
wrapper or middleware covering this action was found in the supplied files. - Preconditions: any valid session and a target application id.
- Impact: unauthorized modification of another user's records.
- Fix: scope the write to the session user, for example
where: { id, userId: session.user.id }withupdateMany, and treat a
zero-row result as "not found." - Regression test: user B calls
moveApplicationon user A's
application → rejected and record unchanged; user A on their own → succeeds. - Verification: observed (code read); not tested.
listApplications is scoped by userId in the query. No supported
finding for that action.
D. Suggested regression tests
- No session → rejected
- User B modifies user A's application → rejected, record unchanged
- User A modifies their own application → succeeds
- Invalid status value → rejected by validation
E. Unresolved questions and uninspected areas
- Route handlers, middleware, and any agent or MCP tool handlers that call
moveApplicationwere not supplied. - Client components were not inspected.
F. Commands run
None run.
Next steps: apply the scoped write, add the four tests, then re-run the
review on any agent tool handlers that reuse this logic.
Connects securely to your tools. The creator never sees your data.
About this skill
Securing Next.js applications requires more than just middleware. This skill solves the problem of "silent" authorization leaks where server actions, route handlers, or AI agent tools lack proper ownership checks or tenant isolation. It prevents common IDOR vulnerabilities and client-side gating mistakes that standard linters miss.
What it does
- Entry point mapping identifies every server action, route handler, and server component to ensure no boundary is overlooked.
- Trace authorization follows the logic from the request through to the ORM or database query to verify resource ownership.
- Tenant leak detection flags instances where a user can access or mutate another user's data by simply providing a resource ID.
- Client-only gate detection finds UI-level role checks that aren't backed by server-side enforcement.
- Regression test generation provides specific test cases for Vitest or Jest to ensure fixes remain in place.
How it works
- Analyze environment to detect Next.js versions, auth libraries like Auth.js or Clerk, and the intended role model.
- Scan entry points including
"use server"actions androute.tsfiles to build an attack surface map. - Inspect data access by tracing symbols into Prisma, Drizzle, or SQL calls to check for missing
whereclauses on user IDs. - Generate findings with severity ratings, code evidence, and framework-agnostic or tool-specific test cases.
Frameworks & tools
Specifically designed for Next.js App Router and Pages Router. Works with common auth providers like Auth.js (NextAuth), Clerk, and Kinde, as well as ORMs like Prisma and Drizzle.
Why this beats prompting it yourself
Generic prompts often miss the nuance of how Next.js server actions bypass standard middleware or how AI agent tool handlers can be exploited as unsecured endpoints. This skill uses a systematic workflow to ensure every data-fetching boundary is validated against your actual access model, not just "best practices."
Use cases
- Reviewing a new feature's server actions for IDOR vulnerabilities before a PR merge.
- Auditing a multi-tenant application to ensure users cannot view other tenants' records.
- Verifying that sensitive AI agent tools have the same permission checks as the web UI.
- Scaffolding a regression test suite for a legacy Next.js codebase.
Known limitations
This is a read-only review of authorization logic. It does not perform dependency scanning, cryptographic audits, or penetration testing, and requires access to the project files or code excerpts.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Read-only review of access control logic only. No support for non-Next.js frameworks. Cannot detect infrastructure-level or cryptographic vulnerabilities. Requires source code access.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 14 days ago
- Free with an Agensi account
Permissions
File Scopes
Read-only. Never writes files, runs commands, or makes network calls unless the user explicitly grants permission.