.claude/skills/learned/example-jwt-validation/SKILL.md
Prevent algorithm confusion attacks when validating JWTs — RS256 tokens accepted as HS256
npx skillsauth add andrem-sec/psc-comet jwt-algorithm-confusion-preventionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Note: This is an example learned skill showing the format. Replace it with skills captured from your actual codebase using the learner skill.
JWT libraries that accept any algorithm will validate an RS256-signed token as HS256 if you use the public RSA key as the HMAC secret. The attacker signs a token with the public key using HS256 — the library accepts it because the signature is valid under HS256 with that key. This is not a theoretical attack.
The symptom that brings you here: authentication bypass with valid-looking tokens. No error in logs. The token passes signature verification. The bug is invisible unless you know to look for it.
This skill applies when:
Explicit algorithm allowlist at configuration time, not call time.
Wrong — algorithm from token header trusted:
jwt.decode(token, key) # uses alg from token header
Right — algorithm enforced by verifier:
jwt.decode(token, key, algorithms=["RS256"]) # rejects anything else
Also verify:
"none" algorithm is explicitly rejected (not just "not in the list" — some libraries require explicit rejection)"none" algorithm is explicitly rejecteddata-ai
Parallel agent swarm — decomposes work into independent units, spawns isolated workers, tracks PRs via fan-in
testing
Audit animations and transitions for motion accessibility, performance safety, and design intent. Enforces prefers-reduced-motion compliance and blocks layout-triggering transitions.
testing
Test specifically for AI-introduced regressions that repeat without tests
development
Framework for decomposing agent-driven tasks into independently verifiable units