Skip to content

Harden JWT validation against signature bypass (CWE-347) - #9

Merged
papac merged 4 commits into
mainfrom
chore/package
Oct 8, 2026
Merged

papac merged 4 commits into
mainfrom
chore/package

Conversation

@papac

@papac papac commented Oct 8, 2026

Copy link
Copy Markdown
Member
  • validate() now verifies the signature (SignedWith) and time claims in addition to iss/aud/id. Previously a token forged with any key passed claim validation because the signature was never checked.
  • Add authenticate(): verify signature + expiry, then return the parsed token, as a safe alternative to the unverified decode()/parse().
  • Middleware now enforces the configured issuer and audience.

Adds a regression test asserting a forged token is rejected.

papac added 4 commits October 4, 2026 06:26
- validate() now verifies the signature (SignedWith) and time claims in
  addition to iss/aud/id. Previously a token forged with any key passed
  claim validation because the signature was never checked.
- Add authenticate(): verify signature + expiry, then return the parsed
  token, as a safe alternative to the unverified decode()/parse().
- Middleware now enforces the configured issuer and audience.

Adds a regression test asserting a forged token is rejected.
@papac
papac merged commit 0d491ac into main Oct 8, 2026
4 checks passed
@papac
papac deleted the chore/package branch October 8, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant