Repository navigation
fix: decode JWT claims as UTF-8 - #145
Merged
Merged
Conversation
nicknisi
marked this pull request as ready for review
October 9, 2026 17:54
|
nicknisi
deleted the
riker/119-fix-workos-authkit-js-issue-144-https-gi
branch
October 9, 2026 18:34
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.
Fix workos/authkit-js issue #144 (#144):
getClaims/decodeJwtinsrc/utils/jwt.tsgarble non-ASCII claim values.decodeBase64Urlreturnsatob(...), which yields one character per byte, and the result goes straight toJSON.parse, so a claim likeAcme Cafécomes out asAcme Café. Decode the bytes as UTF-8 before parsing, for both the header and the payload. The issue suggestsnew TextDecoder().decode(Uint8Array.from(binary, c => c.charCodeAt(0))). Add regression tests insrc/utils/jwt.test.ts: a payload with a multi-byte claim (Acme Café), plus a claim using a 4-byte character such as an emoji, round-tripped throughdecodeJwtandgetClaims. Each test must fail on the old code and pass on the new. Plain-ASCII behaviour and error handling must stay unchanged.Riker's check
npx jest src/utils/jwt.test.ts && npm run format:check && npm run buildpassed.Opened as a draft by Riker (job 119).