Files
cozystack/packages/system/dashboard
Alexey Artamonov 4ad4a44014 fix(dashboard): keep re-login working across tabs after logout
With OIDC enabled, signing out of the dashboard and signing back in
often ends on the oauth2-proxy 403 page even though Keycloak accepted
the password. The gatekeeper log shows

  Invalid authentication via OAuth2: CSRF token mismatch, potential attack

oauth2-proxy keeps the state of a pending login in a single
kc-access_csrf cookie. After a logout every other open console tab
gets a 401 on its next API call or watch reconnect and starts its own
sign-in, which overwrites that cookie, so the callback of the tab the
user is typing into no longer matches. Giving each flow its own CSRF
cookie keeps concurrent sign-ins independent; the limit caps how many
abandoned flows can accumulate in the request headers.

Tested by running the chart-rendered oauth2-proxy v7.12.0 config
against a live Keycloak with two tabs signing in after a logout:
without the flags the first tab gets the 403 above, with them both
sign-ins complete.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-12-01 16:07:22 +03:00
..
2024-07-16 17:31:52 +02:00