fix: show username (not Kanidm UUID) in the account panel #66

Sammanfogat
supernaut sammanfogade 1 incheckning från fix/account-panel-username in i main 2026-07-19 21:56:15 +00:00
Ägare

Closes #63.

The account panel rendered user.sub — the opaque Kanidm subject UUID — under the "username" label, so logged-in users saw a UUID where their username should be. preferred_username was read in normalizeClaims but discarded by userFromClaims.

Fix: carry preferred_username through the session as a distinct username field and display it, falling back to sub only if the IdP omits it. sub is kept for API references (the Renovate group write in renovate.ts).

pnpm check/lint/build clean; 55 tests pass (2 new userFromClaims cases). Surfaced by the pre-onboarding audit (M2).

Closes #63. The account panel rendered `user.sub` — the opaque Kanidm subject **UUID** — under the "username" label, so logged-in users saw a UUID where their username should be. `preferred_username` was read in `normalizeClaims` but discarded by `userFromClaims`. Fix: carry `preferred_username` through the session as a distinct `username` field and display it, falling back to `sub` only if the IdP omits it. `sub` is kept for API references (the Renovate group write in `renovate.ts`). `pnpm check`/`lint`/`build` clean; 55 tests pass (2 new `userFromClaims` cases). Surfaced by the pre-onboarding audit (M2).
supernaut lade till 3 incheckningar 2026-07-19 07:07:18 +00:00
clientIp read the leftmost XFF entry, which is client-controlled: Caddy appends
the real client IP as the last entry and does not strip a client-supplied header,
so an attacker could send a unique fake leading value per request and never trip
the signup/captcha per-IP rate limits. Take the last (rightmost) hop instead
(one proxy hop, mirroring Forgejo's REVERSE_PROXY_LIMIT=1). Adds http.test.ts.
fix(db): handle pg pool idle-client errors so a Postgres blip can't crash the server
Alla kontroller lyckades
ci / ci (pull_request) Successful in 57s
790a166362
node-postgres emits 'error' on idle clients when Postgres drops a connection
(restart, failover, network blip). With no listener that is an uncaught exception
that crashes the whole Node process, taking down the entire portal. Log and let
the pool recover on the next query.
fix(panel): show the username, not the Kanidm UUID, in the account panel
Alla kontroller lyckades
ci / ci (pull_request) Successful in 57s
a0067bb38e
The account panel rendered user.sub (the opaque Kanidm subject UUID) under the
'username' label. Carry preferred_username through the session as a distinct
'username' field and display it (falling back to sub only if the IdP omits it);
sub stays for API references such as the Renovate group write.
supernaut tvångsskickade fix/account-panel-username från a0067bb38e
Alla kontroller lyckades
ci / ci (pull_request) Successful in 57s
till 1591448a83
Alla kontroller lyckades
ci / ci (pull_request) Successful in 54s
2026-07-19 21:54:03 +00:00
Jämför
supernaut sammanfogade incheckning 36e1e714e2 till main 2026-07-19 21:56:15 +00:00
supernaut tog bort grenen fix/account-panel-username 2026-07-19 21:56:15 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-07-29 22:25:17 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:50 +00:00
Logga in för att delta i denna konversation.
Inga granskare
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!66
Ingen beskrivning angiven.