Repository navigation
fix(auth): decode the JWT payload as UTF-8 in both React apps - #1439
Merged
iammukeshm merged 2 commits intoNov 3, 2026
Merged
Conversation
decodeJwt used a bare atob, which returns one char per byte. The token payload is UTF-8, so non-ASCII claims rendered as mojibake: a display name "Comitê de Ética" showed as "Comitê de Ética" in the user menu and the overview greeting. The token and the database were correct. Decode the bytes with TextDecoder. The test fakeJwt helpers now emit UTF-8 like the server, and one spec per app covers an accented name.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
iammukeshm
approved these changes
Nov 3, 2026
iammukeshm
left a comment
Member
There was a problem hiding this comment.
Good catch. TextDecoder over the atob bytes is the correct fix, and updating the fakeJwt helpers so the tests actually emit UTF-8 is what makes this regression-proof. Thanks!
marcelo-maciel
added a commit
to marcelo-maciel/dotnet-starter-kit
that referenced
this pull request
Nov 4, 2026
O atob devolve um caractere por byte (Latin-1) e o servidor assina o payload em UTF-8, então "João Conceição" aparecia como "João Conceição". Os bytes passam pelo TextDecoder, como no upstream fullstackhero fullstackhero#1439. Spec nos dois apps decodifica um token montado em UTF-8 pelo próprio módulo do app; com o decodificador anterior ele falha.
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.
Fixes #1438
What
decodeJwt(dashboard and admin) now decodes the base64url payload as UTF-8 withTextDecoderinstead of a bareatob.atobreturns one character per byte, so a non-ASCII claim such as the display name "Comitê de Ética" rendered as "Comitê de Ética" in the user menu and the overview greeting.Tests
tests/auth/jwt-utf8.spec.tsin each app seeds an accented name and asserts it renders intact and that noÃappears.fakeJwthelpers intests/helpers/auth-seed.tsnow emit UTF-8 bytes like the server. The oldbtoa(JSON.stringify(...))helper could not produce a UTF-8 token, which is why the bug was invisible.jwt.tsreverted toatobthe new spec fails in both apps; with the fix it passes in both.tsc -b --noEmitclean in both apps, lint has 0 errors.upstream/main, with different specs each time) and pass when re-run alone.Docs: fullstackhero/docs PR follows (changelog entry).