Scope
Port Bun corpus position 4022, js/third_party/jsonwebtoken/jwt.malicious.test.js.
Acceptance criteria
- HS verification rejects RSA KeyObjects and RSA PEM strings even when both HS256 and RS256 are allowlisted.
- Verification validates key material without invoking attacker-controlled
toStringmethods. - Algorithm allowlists and key-family checks run before signature comparison.
- Key-policy failures retain concrete JWT error identity, claim/operation metadata, original cause, and operation-aware cause stacks.
- Focused, HMAC/asymmetric regressions, and permanent diagnostics pass.