Skip to content

fix(jwt): reject a signature segment outside the base64url alphabet and a header with crit - #5597

Merged
yusukebe merged 1 commit into
mainfrom
fix/jwt-signature-charset
Nov 1, 2026
Merged

yusukebe merged 1 commit into
mainfrom
fix/jwt-signature-charset

Conversation

@yusukebe

@yusukebe yusukebe commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

verify() accepted a signature segment that contains characters outside the base64url alphabet, such as trailing whitespace, because the decoder ignored them. Several different token strings therefore verified as the same token. The signature segment is now checked against the base64url alphabet before decoding, and such tokens are rejected with JwtTokenInvalid.

It also rejects a header with crit. Hono implements no JWS extensions, so any crit must be rejected (RFC 7515, 4.1.11).

Reported by @harshit-d3v.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • pnpm run check:fix to format and lint the code
  • Add TSDoc/JSDoc to document the code

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Bundle size check

main (d88fab3) #5597 (9d7b5e2) +/-
Bundle Size (B) 19,158B 19,158B 0B
Bundle Size (KB) 18.71K 18.71K 0K

Compiler Diagnostics (tsc)

main (d88fab3) #5597 (9d7b5e2) +/-
Files 83 83 0
Lines 59,458 59,458 0
Identifiers 60,635 60,635 0
Symbols 106,536 106,536 0
Types 163,092 163,092 0
Instantiations 414,023 414,023 0
Memory used 208,730K 208,921K +191K
I/O read 0.01s 0.01s 0s
I/O write 0s 0s 0s
Parse time 0.3s 0.31s +0.01s
Bind time 0.11s 0.1s -0.01s
Check time 1.25s 1.29s +0.04s
Emit time 0s 0s 0s
Total time 1.66s 1.71s +0.05s

Compiler Diagnostics (typescript-go)

main (d88fab3) #5597 (9d7b5e2) +/-
Files 215 215 0
Lines 121,020 121,020 0
Identifiers 107,363 107,363 0
Symbols 181,168 181,168 0
Types 262,348 262,348 0
Instantiations 621,588 621,588 0
Memory used 154,046K 153,942K -104K
Memory allocs 1,783,886 1,783,131 -755
Config time 0.001s 0.001s 0s
BuildInfo read time 0.001s 0s -0.001s
Parse time 0.104s 0.085s -0.019s
Bind time 0s 0s 0s
Check time 0.453s 0.495s +0.042s
Emit time 0.005s 0.005s 0s
Changes compute time 0.038s 0.025s -0.013s
Total time 0.641s 0.65s +0.009s

Reported by octocov

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

HTTP Performance Benchmark

Framework Runtime Average Ping Query Body
hono (origin/main) bun 45,566.14 59,049.61 42,117.65 35,531.17
hono (current) bun 45,858.92 58,953.93 41,941.43 36,681.40
Change +0.64% -0.16% -0.42% +3.24%

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.15%. Comparing base (bac5c4a) to head (ef37c9e).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5597      +/-   ##
==========================================
- Coverage   80.31%   80.15%   -0.17%     
==========================================
  Files         149      150       +1     
  Lines       10529    10565      +36     
  Branches     2358     2353       -5     
==========================================
+ Hits         8456     8468      +12     
- Misses       2073     2097      +24     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yusukebe
yusukebe merged commit e1dd588 into main Nov 1, 2026
22 checks passed
@yusukebe
yusukebe deleted the fix/jwt-signature-charset branch November 1, 2026 02:49
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