Skip to content

[v3-4-test] Keep the token cookie set by a route in JWTRefreshMiddleware (#75217) - #75454

Merged
vincbeck merged 1 commit into
v3-4-testfrom
backport-99eff46-v3-4-test
Oct 23, 2026
Merged

vincbeck merged 1 commit into
v3-4-testfrom
backport-99eff46-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

JWTRefreshMiddleware appends its own _token Set-Cookie after the
response headers. When the route itself sets _token, the browser
applies the middleware cookie last, so it overrides the route:

  • A login route, e.g. an auth manager callback mounted under /auth,
    sets a fresh token while the request still carries an expired or
    invalid one. The middleware appends a deletion and the user is
    logged out right after logging in.
  • /api/v2/auth/logout deletes the cookie, but if refresh_user returned
    a refreshed user for that request the middleware appends a newly
    minted, unrevoked token and the user stays logged in.

Skip the middleware token cookie when the response already sets
_token. Stale root-path cookies are still cleared.
(cherry picked from commit 99eff46)

Co-authored-by: Mathieu Monet 60776491+stegololz@users.noreply.github.com
Co-authored-by: Claude Opus 5.5 noreply@anthropic.com

…are (#75217)

JWTRefreshMiddleware appends its own _token Set-Cookie after the
response headers. When the route itself sets _token, the browser
applies the middleware cookie last, so it overrides the route:

- A login route, e.g. an auth manager callback mounted under /auth,
  sets a fresh token while the request still carries an expired or
  invalid one. The middleware appends a deletion and the user is
  logged out right after logging in.
- /api/v2/auth/logout deletes the cookie, but if refresh_user returned
  a refreshed user for that request the middleware appends a newly
  minted, unrevoked token and the user stays logged in.

Skip the middleware token cookie when the response already sets
_token. Stale root-path cookies are still cleared.
(cherry picked from commit 99eff46)

Co-authored-by: Mathieu Monet <60776491+stegololz@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Oct 23, 2026
@vatsrahul1001
vatsrahul1001 marked this pull request as ready for review October 23, 2026 10:34
@vincbeck
vincbeck merged commit 9e16507 into v3-4-test Oct 23, 2026
143 checks passed
@vincbeck
vincbeck deleted the backport-99eff46-v3-4-test branch October 23, 2026 15:22
@github-actions github-actions Bot added this to the Airflow 3.4.1 milestone Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.4.1 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants