audit-auth-flows
Read-only audit of app-layer auth: route×gate matrix, session lifecycle, OAuth, provider traps (getSession vs getUser, middleware-only gates, CVE-2025-29927).
Skill by kensaurus
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/kensaurus-audit-auth-flows
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/audit-auth-flows
What's inside
- Skill name
audit-auth-flows- Description
- Read-only audit of app-layer auth: route×gate matrix, session lifecycle, OAuth, provider traps (getSession vs getUser, middleware-only gates, CVE-2025-29927). Use when "audit our auth" or "check middleware protection". RLS → plan-rls-audit.
- License
- MIT
- Instructions
- 258 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# audit-auth-flows — Middleware is edge routing, not a security boundary
**Degree of freedom: MIXED — declared per phase**
- Phases 0–4 (discovery, judgment): **[HIGH freedom]** — reason about what
you find; checklists prompt investigation, they are not tick-scripts.
- Phase 5 (live probes) and the getSession grep: **[LOW freedom — run
exactly]** — a skipped probe is an unproven claim, not a saved step.
Read-only. Map the auth surface and prove, route by route, that identity is
verified where it matters. Then stop. Hand fixes to a follow-up session.
**2026 consensus (official, post CVE-2025-29927):** Next.js middleware
runs before cache and routing. Vercel: *"We do not recommend Middleware
to be the sole method of protecting routes in your application."* An
audit that only reads `middleware.ts` and declares the app safe has
missed the point. Defense in depth: edge + route handler / server action
+ data layer. Each layer covers a different part of the request path.
## How to reason in this audit
Every finding is recorded in this shape, in this order:
1. **Observe** — what does the code/probe actually show? (quote the line or the response)
2. **Interpret** — what does that mean for who can reach what? (don't assume intent)
3. **Classify** — real exposure / defense-in-depth-gap / correct-as-is / needs-a-probe
4. **Severity** — by blast radius: unauth data access & auth bypass = critical;
everything else justified against what an attacker actually gains.
If you cannot complete Interpret from static code, it is a **needs-a-probe**
item for Phase 5, not a conclusion.
## Worked example
> **Observe:** `middleware.ts` matcher is `['/dashboard/:path*']`. The route
> `/api/orders/[id]` has no check in the handler.
> **Interpret:** API routes are not under the matcher, so middleware never
> runs on them; the order endpoint is reachable without auth. Layout-level
> checks don't cover direct API calls.
> **Classify:** real exposure (not merely a defense-in-depth gap — data is
> actually reachable).
> **Severity:** critical — unauthenticated data access.
> **Finding row:** `/api/orders/[id]` | edge+route | critical | matcher
> excludes /api; handler has no `getUser()` check | probe P5-a confirmed
> 200 while logged out.
## This skill vs neighbors
| Skill | Owns |
|---|---|
| **audit-auth-flows** (this) | Session lifecycle, route×gate matrix, OAuth, provider traps |
| `audit-security` | OWASP checklist (injection, headers, deps) — may fix inline |
| `plan-security-audit` | Plan-only hardening burndown |
| `plan-rls-audit` | Data-layer who-can-read-which-rows |
| `plan-secrets-audit` | Where `service_role` / keys live |
| `plan-privacy-compliance` | Consent / policy vs collection — not session gates |
| `backend-patterns` | Building the middleware / guard fixes after this audit |
| `test-exploratory` | Live guest vs logged-in probe (runtime complement to this static matrix) |
---
## Phase 0 — Detect the auth stack [HIGH freedom]
Identify: provider (Supabase Auth / NextAuth / Clerk / Auth0 / custom),
framework protection (Next.js middleware + `matcher`, route guards,
server-action checks), session transport (cookie vs `localStorage` vs
`Authorization` header), token model (JWT vs server session). Enumerate
pages, API routes, server actions, edge functions, admin areas. Record
the pinned framework version — auth CVEs are version-gated.
---
## Phase 1 — Route × gate coverage matrix [HIGH freedom — the centerpiece]
Every protected route / action, one row. Apply the reasoning chain per row.
| route/action | intended access | gate that protects it | verified server-side? | data-layer backstop? |
Hunt the gaps this exposes:
- **Matcher holes** — `config.matcher` misses a protected path. API
routes and server actions often bypass page middleware — each needs
its own check.
- **Layout-only protection** — a layout/wrapper is a client-side
illusion. It does not gate data fetches or direct API/action calls.
- **Middleware-as-only-gate** — the CVE-2025-29927 class. Any route
where middleware is the *sole* authorization layer is a finding
**regardless of framework version or host**. Patching the CVE is not
defense in depth.
- **Server action exposure** — Next.js server actions are POST
endpoints callable directly. Each mutating action must check identity
itself.
- **Unlisted routes** — grep the router; do not trust the matcher list.
---
## Phase 2 — Provider and framework traps [HIGH freedom, except the grep = LOW]
**Supabase (check first on this stack):**
- **[LOW freedom — run exactly]** `grep -rn "getSession(" <server-code-paths>`.
Treat every server-side hit as a finding until proven client-side-only.
Official JS docs: cookie/storage values *may not be authentic*;
`getSession()` is strongly advised against for authorization.
`getUser()` performs a network request to the Auth server and *can* be
used to base authorization rules. Newer SSR guides also use
`getClaims()` to *refresh* cookies — that is not a substitute for
verifying identity at the handler.
- Service-role key on any client-exposed path → `plan-secrets-audit`.
RLS assumed but not enforcing → `plan-rls-audit` (data-layer
backstop; this skill is the app layer above it).
- `autoRefreshToken` disabled without manual refresh; JWT expiry
absurdly short (<300s) hammering refresh.
**Next.js CVE-2025-29927** (GHSA-f82v-jwr5-mffw, critical): bypass
authorization if the check occurs only in middleware, via the internal
`x-middleware-subrequest` header. **Patched:** 12.3.5 / 13.5.9 /
14.2.25 / 15.2.3. **Impacted:** self-hosted `next start` and
`output: 'standalone'`. Vercel-hosted apps were incidentallyFrom kensaurus/skills, MIT.
More from kensaurus/skills
- 0.633score
create-skill
kensaurus
Guide users through creating effective Agent Skills for Cursor.
SkillAFreshness: A★ 9Claude Code +9 - 0.633score
audit-agent-speed
kensaurus
Measure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans.
SkillAFreshness: A★ 9Claude Code +9 - 0.629score
audit-backend-architecture
kensaurus
Read-only backend-architecture audit and pattern advisor, gated by stack.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
audit-analytics
kensaurus
Read-only audit of product-analytics events (PostHog, Amplitude, Mixpanel, GA4): taxonomy, funnels, consent-gated firing, dead or duplicate events.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
create-rule
kensaurus
Create Cursor rules for persistent AI guidance.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
split-to-prs
kensaurus
Split current work into small reviewable PRs.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
update-cursor-settings
kensaurus
Modify Cursor/VSCode user settings in settings.json.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
audit-accessibility
kensaurus
WCAG 2.2 AA audit via playwright-cli: axe-core, keyboard, contrast, target size, focus, ARIA.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
audit-bundle-size
kensaurus
Analyse and shrink a web app's JavaScript bundle.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
audit-cicd
kensaurus
Audit GitHub Actions CI/CD for cost, speed, and safety.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
audit-code-quality
kensaurus
Detect and fix repo-wide anti-patterns and consistency drift (naming, organisation, repeated smells).
SkillAFreshness: A★ 9Claude Code +9 - 0.625score
create-hook
kensaurus
Create Cursor hooks.
SkillAFreshness: A★ 9Claude Code +9
Signals
- Stars
- 9
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Sep 23, 2026 (1 month ago)
- Last release
- Oct 19, 2026 (10 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/kensaurus/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from kensaurus
- 0.633score
audit-agent-speed
kensaurus
Measure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans.
SkillAFreshness: A★ 9Claude Code +9 - 0.633score
create-skill
kensaurus
Guide users through creating effective Agent Skills for Cursor.
SkillAFreshness: A★ 9Claude Code +9 - 0.629score
audit-backend-architecture
kensaurus
Read-only backend-architecture audit and pattern advisor, gated by stack.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
create-rule
kensaurus
Create Cursor rules for persistent AI guidance.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
split-to-prs
kensaurus
Split current work into small reviewable PRs.
SkillAFreshness: A★ 9Claude Code +9 - 0.628score
audit-analytics
kensaurus
Read-only audit of product-analytics events (PostHog, Amplitude, Mixpanel, GA4): taxonomy, funnels, consent-gated firing, dead or duplicate events.
SkillAFreshness: A★ 9Claude Code +9
Cite this page
audit-auth-flows skill. Agent Mart. https://agentmart.dev/skills/kensaurus-audit-auth-flows (last updated 2026-10-24)