Files
cozystack/packages
Alexey Artamonov cabbb8faf0 fix(linstor-gui): keep concurrent and slow sign-ins from failing on CSRF
The linstor-gui gatekeeper runs oauth2-proxy with the same single,
15-minute CSRF cookie the dashboard had. Once the session ends, for
example after a logout from the dashboard, every linstor-gui tab that
is reloaded starts its own sign-in and overwrites the cookie of the
others, so finishing the login in any tab but the last one fails with
a 403 and "CSRF token mismatch, potential attack"; a login page left
open for more than 15 minutes fails the same way with "CSRF cookie
... was not found", although Keycloak still accepts it.

Give each sign-in its own CSRF cookie, cap how many can pile up in the
request headers, and keep them for 1h instead of 15 minutes, which
outlives Keycloak's 30-minute login lifespan. The lifetime stays
finite and well inside --cookie-expire (168h): an older CSRF cookie
fails signature validation and the per-request limit skips it instead
of deleting it, so a longer-lived cookie would accumulate.

Tested by running oauth2-proxy v7.12.0 with the chart-rendered
gatekeeper arguments against a live Keycloak: with two tabs signing in
after the session ended, the current arguments fail the first tab
with the CSRF mismatch and the new ones sign both in.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-12-02 16:11:15 +03:00
..