Say which identity write failed and why, instead of one generic error #152

Stängd
öppnade 2026-08-02 12:30:07 +00:00 av supernaut · 0 kommentarer
Ägare

setPersonAttrs collapses every non-OK response into { ok: false, reason: "error" }. The
identity provider returns a clean distinction — 400 for an invalid value, 409 for one already in
use, naming the conflicting attribute — and we throw it away. So "that address is malformed" and
"that address already belongs to another account" both render as "something went wrong on our
side", which points the user at us instead of at their input.

Two follow-on problems:

  1. /auth/confirm-email consumes the single-use token before the write. That ordering is right
    against replay, but it means a rejected value burns the link: the user must start over, and if
    the address is one the identity provider will never accept, they will fail identically every
    time.
  2. Sign-up never logs a non-OK HTTP response — only a thrown network error. The provisioning alert
    matches on that log prefix, so an entire class of rejected input produces no log line and never
    raises anything. This is the same shape of blind spot the alert was added to close.

What to do

  • return a discriminated result from setPersonAttrs (invalid / taken / error), classifying
    on status and the conflicting-attribute field
  • add the matching statuses and copy to the account panel, in both languages
  • check for "already in use" before sending the confirmation email, so the common case is caught
    before a token is minted; keep the post-write check as the authoritative one
  • on a rejected write during confirmation, either leave the token usable or tell the user plainly
    that the address cannot be used, so they do not retry into the same wall
  • log every non-OK response on the provisioning path with enough context for the alert to fire

Part of gitborg/gitborg-docs#66.

`setPersonAttrs` collapses every non-OK response into `{ ok: false, reason: "error" }`. The identity provider returns a clean distinction — 400 for an invalid value, 409 for one already in use, naming the conflicting attribute — and we throw it away. So "that address is malformed" and "that address already belongs to another account" both render as "something went wrong on our side", which points the user at us instead of at their input. Two follow-on problems: 1. `/auth/confirm-email` consumes the single-use token *before* the write. That ordering is right against replay, but it means a rejected value burns the link: the user must start over, and if the address is one the identity provider will never accept, they will fail identically every time. 2. Sign-up never logs a non-OK HTTP response — only a thrown network error. The provisioning alert matches on that log prefix, so an entire class of rejected input produces no log line and never raises anything. This is the same shape of blind spot the alert was added to close. ## What to do - return a discriminated result from `setPersonAttrs` (`invalid` / `taken` / `error`), classifying on status and the conflicting-attribute field - add the matching statuses and copy to the account panel, in both languages - check for "already in use" before sending the confirmation email, so the common case is caught before a token is minted; keep the post-write check as the authoritative one - on a rejected write during confirmation, either leave the token usable or tell the user plainly that the address cannot be used, so they do not retry into the same wall - log every non-OK response on the provisioning path with enough context for the alert to fire Part of gitborg/gitborg-docs#66.
supernaut lade till detta till projektet Bitborg Web 2026-08-02 12:34:19 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web#152
Ingen beskrivning angiven.