Skip to content

[26.0] Cancel background traffic before login/register so session cookie isnt clobbered#22564

Merged
jmchilton merged 1 commit intogalaxyproject:release_26.0from
mvdbeek:auth-cancel-26.0
Apr 26, 2026
Merged

[26.0] Cancel background traffic before login/register so session cookie isnt clobbered#22564
jmchilton merged 1 commit intogalaxyproject:release_26.0from
mvdbeek:auth-cancel-26.0

Conversation

@mvdbeek
Copy link
Copy Markdown
Member

@mvdbeek mvdbeek commented Apr 25, 2026

When handle_user_login invalidates the previous anonymous session and a concurrent request using the old cookie is still in flight, the server creates a new anonymous session for it and responds with a fresh Set-Cookie: galaxysession=<anon>. If that response lands between the login POST and the full-page navigation, the browser navigates with the anonymous cookie and the new page loads logged out.

Fix: synchronously stop the polling watchers and rotate a shared AbortController before sending the login/register POST. The shared signal is wired through both axios (via a request interceptor) and the GalaxyApi/openapi-fetch client (via a request middleware) so a single rotation cancels every in-flight request, regardless of transport. With no in-flight anonymous-cookie request, the server can't emit the clobbering Set-Cookie, and the authenticated cookie survives until navigation.

Backport of the relevant pieces of #22513 (sse-notifications) for release_26.0 — the same race exists outside SSE because it is the in-flight polling/REST traffic, not the SSE stream itself, that carries the stale cookie.

Should also stabilize occasional unspecific selenium failures that fail around login.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

…'t clobbered

When handle_user_login invalidates the previous anonymous session and a
concurrent request using the old cookie is still in flight, the server
creates a *new* anonymous session for it and responds with a fresh
`Set-Cookie: galaxysession=<anon>`. If that response lands between the
login POST and the full-page navigation, the browser navigates with the
anonymous cookie and the new page loads logged out.

Fix: synchronously stop the polling watchers and rotate a shared
AbortController before sending the login/register POST. The shared signal
is wired through both axios (via a request interceptor) and the
GalaxyApi/openapi-fetch client (via a request middleware) so a single
rotation cancels every in-flight request, regardless of transport. With
no in-flight anonymous-cookie request, the server can't emit the
clobbering Set-Cookie, and the authenticated cookie survives until
navigation.

Backport of the relevant pieces of galaxyproject#22513 (sse-notifications) for
release_26.0 — the same race exists outside SSE because it is the
in-flight polling/REST traffic, not the SSE stream itself, that carries
the stale cookie.
@mvdbeek mvdbeek added the area/auth Authentication and authorization label Apr 25, 2026
@github-actions github-actions Bot added this to the 26.1 milestone Apr 25, 2026
@jmchilton jmchilton merged commit 5198d67 into galaxyproject:release_26.0 Apr 26, 2026
31 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/API area/auth Authentication and authorization area/UI-UX kind/bug

Projects

Development

Successfully merging this pull request may close these issues.

2 participants