fix(auth): sign out locally when the stored id token is from another issuer #362

Sammanfogat
supernaut sammanfogade 1 incheckning från fix/signout-stale-session in i main 2026-10-11 18:16:01 +00:00
Ägare

Closes #352

A session from before the identity provider change holds an id token from the old issuer. Sign-out sent it as id_token_hint, and Keycloak rejected the foreign hint with an error page.

Sign-out now reads the stored token's iss. When it differs from the current issuer, the route clears the session cookies and redirects to the portal home without calling the end-session endpoint. A current Keycloak token still goes to the end-session endpoint with the hint, as before.

  • idTokenIssuer reads iss without verification. It only decides whether to send the hint, so a forged cookie can at most turn sign-out into a local sign-out.
  • A missing token still goes to the end-session endpoint without a hint (Keycloak's confirm page), as before. An empty or malformed token now signs out locally.
  • Version 1.34.9.

Tests: src/test/logout.test.ts covers a current-issuer token (end-session with hint) and a foreign-issuer token (local sign-out to /, both cookies cleared). The foreign-issuer test fails without the fix. Pre-push ran lint, type-check, vitest, build and e2e.

Closes #352 A session from before the identity provider change holds an id token from the old issuer. Sign-out sent it as `id_token_hint`, and Keycloak rejected the foreign hint with an error page. Sign-out now reads the stored token's `iss`. When it differs from the current issuer, the route clears the session cookies and redirects to the portal home without calling the end-session endpoint. A current Keycloak token still goes to the end-session endpoint with the hint, as before. - `idTokenIssuer` reads `iss` without verification. It only decides whether to send the hint, so a forged cookie can at most turn sign-out into a local sign-out. - A missing token still goes to the end-session endpoint without a hint (Keycloak's confirm page), as before. An empty or malformed token now signs out locally. - Version 1.34.9. Tests: `src/test/logout.test.ts` covers a current-issuer token (end-session with hint) and a foreign-issuer token (local sign-out to `/`, both cookies cleared). The foreign-issuer test fails without the fix. Pre-push ran lint, type-check, vitest, build and e2e.
supernaut lade till 1 incheckning 2026-10-11 18:13:24 +00:00
fix(auth): sign out locally when the stored id token is from another issuer
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m50s
fa614e2bab
Closes #352

A session from before the identity provider change holds an id token from the old issuer. Sign-out sent it as `id_token_hint`, and Keycloak rejected the foreign hint with an error page.

Sign-out now reads the stored token's `iss`. When it differs from the current issuer, the route clears the session cookies and redirects to the portal home without calling the end-session endpoint. A current Keycloak token still goes to the end-session endpoint with the hint, as before.

- Version 1.34.9.
supernaut sammanfogade incheckning 907ee103a8 till main 2026-10-11 18:16:01 +00:00
supernaut tog bort grenen fix/signout-stale-session 2026-10-11 18:16:01 +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!362
Ingen beskrivning angiven.