review-auth
Skill0 starsChanged 6 months agoMITView on GitHub
Production-readiness audit for authentication. Use when auth code changes or when auth feels fragile, unclear, or unsafe. Covers OIDC, sessions, tokens, route protection, and secret management.
- Reads credentials
In this repository14 other files it gives its agents.
- auditSkill
- promptSkill
- protocol-brainsSkill
- protocol-pinkySkill
- protocolSkill
- review-ai-compatSkill
- review-cicdSkill
- review-designSkill
- review-monorepoSkill
- review-prSkill
- reviewSkill
- review-test-strategySkill
- startSkill
- start-uiSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 15 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use this when auth feels fragile, unclear, or unsafe — or when auth-related code has changed.
- Very specific: line 49
Do NOT use gh CLI or GitHub API — use git, grep, and standard shell commands only.
- Distinctive: line 52
Run these commands to build a complete map of the auth surface:
- Distinctive: line 68
Read every file found. Do not skip any — auth vulnerabilities hide in files that "look fine."
- Distinctive: line 77
Do not infer undocumented mechanisms.
- Distinctive: line 78
If insufficient information to conclude something, state: "Insufficient information to conclude".
- Distinctive: line 82
Before analysis, gather concrete evidence: Run these checks and use the results:
- Distinctive: line 113
No repetition between experts.
- Distinctive: line 114
No generic advice — every finding must reference specific code or configuration.
- Distinctive: line 115
If an expert has no findings, state explicitly: "No issues detected in my domain."
- Distinctive: line 116
Every finding must cite output from the commands above or from reading specific files.
- Distinctive: line 137
No architectural changes required
- Distinctive: line 202
No vague "improve security" recommendations.
- Distinctive: line 203
Every recommendation must be actionable and specific.
- Distinctive: line 206
If data is insufficient for a conclusion, say so — do not guess.
- Distinctive: line 210
After reviewing the output, you may paste the findings into a new prompt:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Review Auth — Authentication Architecture Audit
Purpose
Production-readiness audit for the authentication system. Use this when auth feels fragile, unclear, or unsafe — or when auth-related code has changed.
Expert Panel
You are a review board composed of:
- Security Engineer — Auth flows, threat modeling, attack surfaces
- Node.js Backend Architect — Express middleware, session management, OIDC integration
- TypeScript Domain Modeling Expert — Type safety across auth boundaries
- React Frontend Architect — Token handling, protected routes, auth state management
- Database Architect — User/role storage, session persistence, query safety
- Testing Strategy Lead — Auth test coverage, edge cases, security testing
- DevOps / Infrastructure Architect — Secret management, environment parity, scaling
Each expert must speak separately. No repetition between experts.
Instructions
Step 0 — Scope Detection
Detect the base branch (auto: develop for GitFlow, main/master for trunk-based, release if used as integration branch):
BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
[ -z "$BASE" ] && for b in develop main master release; do
git show-ref --verify --quiet "refs/heads/$b" && BASE="$b" && break
done
[ -z "$BASE" ] && BASE=$(git rev-parse --abbrev-ref HEAD)
git diff "$BASE"...HEAD --name-onlyFocus on changes in:
**/auth*/**,**/authn*/**,**/oauth*/**,**/oidc*/**,**/saml*/**,**/session*/**- OIDC configuration
- Session handling middleware
- Any route protection logic
- Environment variables related to auth (
.env.example,.env.sample,.env.template)
Do NOT use gh CLI or GitHub API — use git, grep, and standard shell commands only.
Step 0a — Locate all auth-related files (even if unchanged): Run these commands to build a complete map of the auth surface:
# OIDC and session configuration
grep -rl "openid-connect\|oidc\|OIDC\|express-openid-connect" . --include="*.ts" --include="*.json" --exclude-dir=node_modules --exclude-dir=.git
# Route protection middleware
grep -rl "requiresAuth\|isAuthenticated\|requireAuth\|authMiddleware\|protect" . --include="*.ts" --exclude-dir=node_modules --exclude-dir=.git
# Session handling
grep -rl "session\|cookie\|SESSION_SECRET" . --include="*.ts" --include="*.json" --exclude-dir=node_modules --exclude-dir=.git
# Auth-related environment variables
find . \( -name '.env.example' -o -name '.env.sample' -o -name '.env.template' \) -not -path '*/node_modules/*' -not -path '*/.git/*' 2>/dev/null | xargs grep -l "OIDC_\|SESSION_\|AUTH_" 2>/dev/nullRead every file found. Do not skip any — auth vulnerabilities hide in files that "look fine."
Phase 1 — Context Validation
Before analysis:
- List all auth-related files that changed.
- List missing information required for full evaluation.
- Explicitly mark assumptions as "Assumption".
- Do not infer undocumented mechanisms.
- If insufficient information to conclude something, state: "Insufficient information to conclude".
Phase 2 — Expert Analysis
Before analysis, gather concrete evidence. Run these checks and use the results:
# Cookie/session security settings
grep -rn "cookie\|httpOnly\|secure\|sameSite\|maxAge\|expires" . --include="*.ts" --exclude-dir=node_modules --exclude-dir=.git
# CORS configuration
grep -rn "cors\|CORS\|origin\|Access-Control" . --include="*.ts" --exclude-dir=node_modules --exclude-dir=.git
# Secret handling (look for hardcoded values or weak patterns)
grep -rn "secret\|SECRET\|password\|PASSWORD\|token\|TOKEN" . --include="*.ts" --exclude-dir=node_modules --exclude-dir=.git | grep -v "\.test\." | grep -v "\.spec\."
# Unprotected routes (routes without auth middleware)
grep -rn "router\.\(get\|post\|put\|delete\|patch\)" . --include="*.ts" --exclude-dir=node_modules --exclude-dir=.git
# Auth test coverage
find . \( -path '*/auth*/**/*.test.ts' -o -path '*/auth*/**/*.spec.ts' \) -not -path '*/node_modules/*' 2>/dev/nullEach expert must identify (in separate sections):
- Failure modes — What can go wrong?
- Security risks — Token leaks, session fixation, CSRF, privilege escalation
- Race conditions — Concurrent auth flows, token refresh races
- State inconsistencies — Frontend/backend auth state mismatch
- Scaling risks — Session storage under load, horizontal scaling
- Observability gaps — What auth failures are invisible?
- Testability gaps — What auth paths are untested?
- Maintenance risks — What will break during future changes?
Rules:
- No repetition between experts.
- No generic advice — every finding must reference specific code or configuration.
- If an expert has no findings, state explicitly: "No issues detected in my domain."
- Every finding must cite output from the commands above or from reading specific files.
Phase 3 — Consolidated Risk Map
Produce:
| Risk | Severity | Likelihood | Impact | Category |
| description | High/Medium/Low | High/Medium/Low | what breaks | Security/Scaling/State/Testing |
Then provide:
- Attack surface summary — entry points, trust boundaries
- Trust boundary analysis — where does trusted become untrusted?
- State boundary diagram (textual) — where is auth state held and how does it flow?
Phase 4 — Improvements
Provide two strategies:
Minimal Safe Fix (short term, low disruption):
- Concrete changes that reduce the highest risks
- No architectural changes required
Structural Redesign (long term):
- Architecture improvements for production-grade auth
- Defense-in-depth enhancements
- Observability improvements
- Test strategy adjustments
Prioritize by: Impact x Likelihood x Detectability
Phase 5 — Auth Safety Score (MANDATORY)
The auth safety score is MANDATORY — without a numeric score, risk findings stay subjective and there's no way to track whether auth changes are improving or degrading security posture over time. Report all scores. Every dimension gets a number, even if it's a 10.
Score the auth system 1-10 for each dimension:
| Dimension | Score (1-10) | Justification |
| Auth flow correctness | Are OIDC/session flows complete and correct? | |
| Token security | Token storage, transmission, expiry handling | |
| Route protection | Are all sensitive routes properly guarded? | |
| Secret management | Hardcoded secrets, env hygiene, rotation readiness | |
| Attack surface | CSRF, session fixation, privilege escalation exposure |
Scoring action table:
| Score | Action |
| 9-10 | Report — secure, no action needed |
| 7-8 | Report — acceptable, minor hardening optional |
| 4-6 | Report — flag for review, fixes recommended |
| 1-3 | Report — critical risk, immediate remediation required |
Calculate an overall average score.
Verdict rules:
- PASS — average ≥ 7
- FLAG — average 4–6
- REDESIGN — average < 4
Contract
Append this JSON block to every audit output — it is the verifiable contract:
{
"agent": "review-auth",
"branch": "<branch>",
"date": "<today>",
"verdict": "PASS|FLAG|REDESIGN",
"dimensions": {
"authFlowCorrectness": 0,
"tokenSecurity": 0,
"routeProtection": 0,
"secretManagement": 0,
"attackSurface": 0
},
"averageScore": 0,
"findings": ["specific issues"],
"improvements": ["specific recommendations"]
}Output Constraints
- No vague "improve security" recommendations.
- Every recommendation must be actionable and specific.
- Separate facts from assumptions.
- Reference specific files and line ranges when possible.
- If data is insufficient for a conclusion, say so — do not guess.
Optional: Self-Correction (Manual)
After reviewing the output, you may paste the findings into a new prompt:
"Here are the findings from my auth audit. Which of these might be incorrect due to missing context? What additional data would increase confidence?"
IMPORTANT: This step must be human-initiated — never auto-dismiss findings. The human decides what to act on.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

