Skip to content

test: add regression tests for fast-jwt security advisories - #431

Merged
Tony133 merged 5 commits into
fastify:mainfrom
corradopetrelli:feat/update-fast-jwt-to-6-3-3
Nov 23, 2026
Merged

Tony133 merged 5 commits into
fastify:mainfrom
corradopetrelli:feat/update-fast-jwt-to-6-3-3

Conversation

@corradopetrelli

@corradopetrelli corradopetrelli commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • AIKIDO-2026-933024
  • AIKIDO-2026-394471
  • AIKIDO-2026-885954
  • AIKIDO-2026-957913
  • AIKIDO-2026-208205

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 symmetric oct JWK still works for signing and verifying.
  • test/jwt.test.js: the expiresIn and notBefore sign options take precedence over exp and nbf in the payload; payload values are kept when those options are not passed.
  • test/options.test.js: cacheTTL: Infinity is accepted, while cacheTTL: NaN and clockTolerance: Infinity throw FAST_JWT_INVALID_OPTION.

@corradopetrelli corradopetrelli changed the title test: cover algorithm confusion and sign option precedence Update fast-jwt to 6.3.3 + regression tests Sep 21, 2026
@corradopetrelli corradopetrelli changed the title Update fast-jwt to 6.3.3 + regression tests fix(vulnerability): Update fast-jwt to 6.3.3 + regression tests Sep 21, 2026
Signed-off-by: Corrado Petrelli <corrado.petrelli@gmail.com>
@Tony133 Tony133 changed the title fix(vulnerability): Update fast-jwt to 6.3.3 + regression tests test: add regression tests for fast-jwt security advisories Nov 23, 2026

@Tony133 Tony133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Tony133
Tony133 merged commit d1a7c4c into fastify:main Nov 23, 2026
51 of 53 checks passed
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.

2 participants