Auth pages read token through the router's JSON parse of search values

Aperta Adatta ai principianti
#2,026 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Leggi src/features/auth/VerifyEmail.tsx e src/features/auth/ResetPassword.tsx, poi segui il modo in cui il router analizza i valori di ricerca. Confronta le due opzioni di correzione dell’issue e verifica come ciascuna pagina di autenticazione ottiene il proprio token. Il lavoro è completato quando le stringhe di token in formato JSON rimangono invariate durante la verifica e la reimpostazione con password; l’issue non indica test da eseguire.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

TanStack Router's default parseSearch runs JSON.parse on every search value, so a token that happens to be valid JSON stops being the string in the URL: digits past 2^53 lose precision, digits with one e turn into exponent form, and 0, true or null stop being strings at all.

  • src/features/auth/VerifyEmail.tsx (with the #1697 verification-outcome change) treats a non-string token as no token. It never sends an altered one, but such a link can never be submitted either.
  • src/features/auth/ResetPassword.tsx casts token as string and sends whatever the parse produced.

No real link is affected today. central-manager's verify and reset tokens are JWTs (Harper signs them with jsonwebtoken), and a JWT is never valid JSON. This is hardening against a change of token format.

Fix options: read token from the raw URL instead of the parsed search, or give the router a parseSearch that leaves token a string. location.searchStr is not a way out: the router re-serializes it from the parsed value.

Review-Deferral: a63aef4471dc1a96 severity=nit category=correctness
Review-Deferral: 8735edf8a60533bd severity=nit category=correctness

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.

Lingua principale
TypeScript
Stelle
5
Fork
4
Merge medio
1g 20h
PR unite (30g)
140

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 HarperFast/studio

Tutte le issue di HarperFast/studio

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.