Audit Auth
Testing & Qualityaudit-authAudit Auth is an Agent Skill for testing & quality published in the vigolium/vigolium repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Audit authentication and session-management code for common issues — weak JWT config, session fixation, password-handling flaws, insecure cookies, broken OAuth flows, and missing auth checks on routes. Use when the user asks to review auth code or when source-aware scanning targets login/session/token handling.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/vigolium/vigolium/blob/HEAD/internal/resources/olium/skills/audit-auth/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/audit-auth, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Authentication & Session Code Audit
You are auditing authentication and session-management code. Your goal is
to identify concrete, reproducible vulnerabilities — not style nits. Each
issue you raise must map to a CWE and a specific file + line range, and
must be persisted via the report_finding tool.
Scope — what to look for
Work through these in order; some targets will be irrelevant (skip and say so in your final summary rather than fabricating findings):
1. JWT / token handling
alg=noneaccepted by the verifier (CWE-327)- Secret reused for HMAC and RSA (key confusion, CWE-347)
- Hard-coded secrets or secrets pulled from non-secret sources
- Missing
iss,aud,expvalidation (CWE-345) - Tokens logged at INFO level (CWE-532)
2. Session management
- Session IDs derived from user input or predictable sources (CWE-330)
- No session rotation on privilege change (CWE-384 session fixation)
- Cookies missing
HttpOnly,Secure, orSameSite(CWE-1004) - Long or unbounded session lifetime
3. Password handling
- Plaintext storage or fast hashes (MD5/SHA1/SHA256 without KDF) (CWE-916)
- Passwords in URL query strings, logs, or error messages
- Timing-unsafe comparison of password hashes (CWE-208)
- No rate limiting on login (CWE-307)
4. OAuth / OIDC
- Missing
state/ PKCE (CWE-352 CSRF on auth flow) - Open redirect on callback (CWE-601)
redirect_urinot validated against allowlist- Token exposure via referer or fragment-in-GET
5. Route-level auth
- Handlers that forget to call the auth middleware
- Role checks on client-supplied fields (e.g., trusting
req.body.role) - IDOR: authorization based on URL param without ownership check (CWE-639)
Recommended workflow
- Inventory: use
globto find auth-related files. Typical patterns:**/auth/**,**/session*,**/login*,**/oauth*,**/middleware*,**/jwt*
- Read the entry points: login handler, session middleware, token verifier.
- Grep for red flags:
alg.*none,jwt.Parse[^A-Z](missing key func)md5|sha1in a hashing contextbcrypt\.CompareHashAndPassword— good; absence of it near a login handler — suspicioushttpOnly\s*:\s*false,secure\s*:\s*falseres.redirect.*req\.(open redirect pattern)
- For each concrete finding, call
report_findingwith:severity: critical | high | medium | lowtitle: short, specific (e.g., "JWT verifier accepts alg=none")cwe_id: CWE-xxxsource_file: relative pathdescription: 1-3 sentences of what + whyremediation: 1-2 sentences of fix
Output expectations
- At least one line of summary per file audited (even if clean).
- Every finding persisted via
report_finding— do NOT just enumerate in your final text message. - If you run out of context (very large codebase), audit the most critical paths first: JWT verification, session creation, login handler. Skip admin panels and internal tools unless explicitly in scope.
- Do NOT flag speculative issues ("this could theoretically be…") — only concrete code paths with file + line.