jwt-security-auditor
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Audits JWT implementation for common security vulnerabilities. Use when reviewing authentication systems that use JSON Web Tokens.
In this repository58 other files it gives its agents.
- agent-chain-designerSkill
- api-wrapper-builderSkill
- embeddings-builderSkill
- evaluation-harnessSkill
- fine-tuning-preparerSkill
- llm-router-builderSkill
- ml-model-trainerSkill
- model-benchmarkerSkill
- prompt-engineerSkill
- rag-pipeline-builderSkill
- synthetic-data-generatorSkill
- vector-db-integratorSkill
- csv-processorSkill
- database-schema-designerSkill
- data-pipeline-builderSkill
- etl-workflow-designerSkill
- json-transformerSkill
- pandas-data-cleanerSkill
- report-generatorSkill
- sql-query-optimizerSkill
- time-series-analyzerSkill
- visualization-generatorSkill
- backup-strategySkill
- ci-cd-optimizerSkill
- docker-compose-generatorSkill
- github-actions-pipelineSkill
- kubernetes-deploymentSkill
- load-balancer-configSkill
- log-aggregator-setupSkill
- monitoring-dashboardSkill
- nginx-config-generatorSkill
- security-hardeningSkill
- ssl-certificate-managerSkill
- terraform-module-builderSkill
- api-security-auditorSkill
- compliance-checkerSkill
- dependency-checkerSkill
- incident-responderSkill
- owasp-checkerSkill
- penetration-test-plannerSkill
- secret-detectorSkill
- threat-model-designerSkill
- vulnerability-scannerSkill
- accessibility-auditorSkill
- api-route-builderSkill
- auth-flow-builderSkill
- css-animation-crafterSkill
- form-validatorSkill
- graphql-schema-designerSkill
- html-component-builderSkill
- nextjs-app-scaffoldSkill
- performance-auditorSkill
- pwa-setupSkill
- react-component-generatorSkill
- responsive-layout-systemSkill
- seo-optimizerSkill
- tailwind-design-systemSkill
- websocket-integrationSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
Check that the library is actually verifying the signature (many footguns in older or custom code).
- Distinctive: line 47
No critical business logic decisions based solely on unverified claims.
- Distinctive: line 51
Never localStorage or sessionStorage for access or refresh tokens (XSS risk).
- Distinctive: line 64
Test cases (none alg, alg confusion, expired token, missing signature, etc.).
- Distinctive: line 79
Run the audit checklist against the implementation — findings are documented with evidence.
- Distinctive: line 80
Test vectors (none alg, expired, wrong audience, alg confusion) are run against the validation code — vulnerable paths are identified.
- Distinctive: line 81
After remediation, the same test vectors are rejected.
≈ “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
Overview
Audits JWT implementations for common and critical vulnerabilities. Covers JWT structure review (header alg, "none" attack, RS256 vs HS256), signature validation, expiry and clock skew handling, sensitive data in payload, token storage (httpOnly cookies vs localStorage), refresh token security, algorithm confusion attacks, and a comprehensive JWT audit checklist with code-level indicators and fixes.
When to Use This Skill
- Reviewing or implementing authentication that uses JWTs.
- Auditing an existing auth system (especially custom JWT code).
- The user mentions "JWT", "JSON Web Token", "access token", or is building login/refresh flows.
Prerequisites
- The JWT implementation code (issuance, validation, refresh).
- Example tokens (valid, expired, malformed).
- Knowledge of how tokens are stored and transmitted on the client.
Steps
- Decode and inspect sample tokens (use jwt.io or
jwt decode):- Header:
alg,typ,kid. - Payload: claims (
sub,exp,iat,aud,iss, scopes/roles, any PII?). - Signature present and looks valid.
- Header:
- Algorithm & signature validation audit:
- Never allow
alg: "none". - For asymmetric (RS256/ES256): verify with public key, never secret.
- For symmetric (HS256): use a strong, long, random secret; never hardcode.
- Check that the library is actually verifying the signature (many footguns in older or custom code).
- Algorithm confusion (HS256 with public key as secret) — test if the implementation is vulnerable.
- Never allow
- Claims validation:
expis checked and enforced (with small clock skew tolerance, e.g., 30-60s).audandissare validated against expected values.iat/nbfconsidered where relevant.- No critical business logic decisions based solely on unverified claims.
- Token storage & transmission:
- httpOnly + Secure + SameSite cookies (strongly preferred for web).
- Never localStorage or sessionStorage for access or refresh tokens (XSS risk).
- Short-lived access tokens (5-15 min) + rotating refresh tokens.
- Refresh tokens stored securely (httpOnly cookie or secure backend session) and rotated on use.
- Refresh & revocation:
- Refresh token rotation (old refresh token is invalidated when a new one is issued).
- Refresh token reuse detection (if the same old token is presented again → revoke the whole family and force re-login).
- Ability to revoke individual sessions or all sessions for a user (e.g., on password change or suspected compromise).
- Output:
- JWT audit checklist (with pass/fail + evidence + severity).
- Code-level red flags to search for ("alg", "verify", "localStorage.setItem", hard-coded secrets, long-lived tokens, etc.).
- Recommended secure patterns (httpOnly cookie issuance, refresh rotation, library usage).
- Test cases (none alg, alg confusion, expired token, missing signature, etc.).
- Remediation steps for each finding.
Examples
A complete JWT audit report for a typical custom JWT implementation (using jsonwebtoken in Node) with several issues (long-lived tokens, localStorage, missing audience check, no refresh rotation, potential alg confusion due to custom verification) plus the exact fixes and test vectors is included.
Edge Cases & Error Handling
- Clock skew between services: Allow small
expleeway but not too much. - Key rotation (kid): Support multiple public keys during rotation; never use the same key forever.
- Token binding (advanced): Consider DPoP or mTLS-bound tokens for high-security scenarios.
Verification
- Run the audit checklist against the implementation — findings are documented with evidence.
- Test vectors (none alg, expired, wrong audience, alg confusion) are run against the validation code — vulnerable paths are identified.
- After remediation, the same test vectors are rejected.
- Token storage is verified in browser (httpOnly cookie, no tokens in localStorage).
- Success: The JWT implementation follows current best practices and resists the common attacks in the checklist.
References
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.

