Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

JWT encoder signs payloads that aren't JSON objects, and the decoder then rejects them

Aperta
#253 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@MugdhoAI ci sta già lavorando.

Dal 22/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug good first issue hacktoberfest

In the JWT decoder's Encode tab, a payload of [1, 2, 3], "hello", 42 or null is signed without complaint. Paste the token into Decode, as the panel suggests, and you get "Payload is not a JSON object". A JWT's claims set has to be a JSON object (RFC 7519), and decodeJwt already checks that (lib/jwt-utils.ts, lines 89 to 91).

generate (app/(tools)/jwt-decoder/components/EncoderTab.tsx, lines 37 to 51) only checks that the payload is valid JSON (line 39) before it signs it (line 51).

What to do

  • After the JSON check, refuse anything that isn't a plain object (arrays, strings, numbers, booleans and null) with an error like "The payload must be a JSON object", shown where the JSON error shows today.
  • Objects sign exactly as before.

Where to look

  • app/(tools)/jwt-decoder/components/EncoderTab.tsx: generate (lines 37 to 51)
  • lib/jwt-utils.ts: the same check in decodeJwt (lines 89 to 91)
  • app/(tools)/jwt-decoder/components/DecodedCard.test.tsx: a component test for this tool

Acceptance criteria

  • [1, 2, 3], "hello", 42, true and null show the error and produce no token
  • An object payload still produces a token that Decode accepts
  • Tests for these cases
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #253 in the description.

Lingua principale
TypeScript
Stelle
1
Fork
9
Merge medio
9h 9m
PR unite (30g)
118

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codercops/toolbelt

Tutte le issue di codercops/toolbelt

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.