issueSignInLink returns a sign-in credential for an existing account with no refuse option

Aperta
#196 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Read packages/auth-provider-email/src/email-provider.ts at issueSignInLink and authenticateWithIdentifier, then find the email provider tests and the README section “Sign-in links for someone else.” Add coverage showing that the default behavior refuses an address with an existing identity without creating a challenge, and document the credential risk if making the README change. Done when the test passes and the warning accurately says the link must go only to that address.

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

Descrizione

Found in the security review of #195 (review comment).

issueSignInLink (email-provider.ts:254) hands the caller a link that redeems through authenticateWithIdentifier, which signs in whichever user already owns the address. So for an address with an account, the returned link is that account's credential, valid for 7 days, and nothing in the API or README says it may only ever reach that address. An app that shows the inviter a "copy invite link" button, logs the link, or puts it in the inviter's outbox gives a signed-in user a session as any account whose email they know.

Confirmed with a throwaway test: issuing for an address whose identity exists and redeeming from a fresh browser returned 200 {"success":true,"user":{"id":"user-existing"}}.

Fix, either or both:

  • An option on issueSignInLink, such as existingAccount: "refuse" | "signIn", defaulting to refuse, so an invite to someone who already has an account returns an error and the app sends a plain "you've been invited, sign in" email instead.
  • A warning in the README's "Sign-in links for someone else" section that the link is a credential for the address and must go only to that address, never to the inviter or a log.

Verified when: a test issues a link for an address with an existing identity and, with the default options, gets a refusal with no challenge created.

Lingua principale
TypeScript
Stelle
0
Fork
2
Merge medio
11g 7h
PR unite (30g)
10

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 activescott/auth

Tutte le issue di activescott/auth

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.