Repository navigation
test: add regression tests for fast-jwt security advisories - #431
Merged
Tony133 merged 5 commits intoNov 23, 2026
Merged
Conversation
Signed-off-by: Corrado Petrelli <corrado.petrelli@gmail.com>
Tony133
approved these changes
Nov 23, 2026
Tony133
left a comment
Member
There was a problem hiding this comment.
Thanks for the regression tests!
I pushed a small follow-up commit that moves the algorithm confusion tests into test/option-hardening.test.js, so they live next to the other fast-jwt hardening tests instead of in a separate file. No changes to the assertions. I also updated the title and description, since the fast-jwt bump has already landed on main and this PR is now test-only.
LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fast-jwt bump originally included here has already landed on
main(currently^6.3.4), so this PR now only adds regression tests for the issues fixed upstream.Related advisories:
What is covered
test/algorithm-confusion.test.js(new): public key material (a serialized asymmetric JWK, a JWKS, a PEM prefixed with a zero-width space) cannot be used as an HMAC secret to forge HS256 tokens. A symmetricoctJWK still works for signing and verifying.test/jwt.test.js: theexpiresInandnotBeforesign options take precedence overexpandnbfin the payload; payload values are kept when those options are not passed.test/options.test.js:cacheTTL: Infinityis accepted, whilecacheTTL: NaNandclockTolerance: InfinitythrowFAST_JWT_INVALID_OPTION.