Skip to content

[v3-4-test] Keep extra cookies set by a route in JWTRefreshMiddleware - #75869

Merged
shahar1 merged 4 commits into
apache:v3-4-testfrom
astronomer:backport-75411
Nov 6, 2026
Merged

shahar1 merged 4 commits into
apache:v3-4-testfrom
astronomer:backport-75411

Conversation

@pierrejeambrun

Copy link
Copy Markdown
Member

Backport of #75411 to v3-4-test.

Cherry-picked from ea2aae7. Clean cherry-pick, no conflicts.

The automatic backport failed because #75411 builds on #70783, which wasn't on v3-4-test. This PR is stacked on #75868 (the backport of #70783). Until that one merges, the diff here also shows its commit, so please merge #75868 first.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5)

Generated-by: Claude Code (Opus 5.5) following the guidelines

@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Oct 28, 2026
@pierrejeambrun pierrejeambrun added this to the Airflow 3.4.1 milestone Oct 28, 2026
@pierrejeambrun

Copy link
Copy Markdown
Member Author

Following Rahul instruction, keep in draft

github-actions Bot and others added 3 commits October 29, 2026 06:45
…ed or yanked (apache#75919) (apache#75924)

Constraints for an Airflow release candidate pin the provider wave being
voted on at its rc versions, and commit them onto the shared
constraints-X-Y branch. The next regular generation for the vX-Y-test
branch resolves without pre-releases, so it saw the older finals as a
provider downgrade and failed - the v3-4-test canary has been red since
3.4.0rc1 for exactly that reason, although nothing was yanked.

The final release has the opposite gap: it ignored the candidates, so a
provider rc that was neither released nor yanked was silently passed
over and the released constraints never recorded that decision. It now
has to be made, and the run says which providers it is still waiting on.

The alert that should have reported the canary failure never reached
Slack because the action was not told which API method to call, and the
twice-daily CI notification announced "All passing" because it read a
run that was still in progress, whose missing conclusion looked like no
failures.
(cherry picked from commit eeae004)


Generated-by: Claude Opus 5

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
…esh_middleware() (apache#70783)

Co-authored-by: Stephen Bracken <email-protected>
(cherry picked from commit e5d8cbb)
* Keep extra cookies set by a route in JWTRefreshMiddleware

The route-wins rule only covered the token cookie, so a cookie returned
by get_extra_cookies was still appended after the same cookie set by the
route. When the session was invalidated, that cleared the cookie a login
callback had just issued.

The generate_new_user_token test passed one-element tuples to a single
parametrized argument, so the case without a new user never ran.

* Split token and cleanup cookie handling in JWTRefreshMiddleware

* Let route cookies win by sending the middleware cookies first

Browsers key cookies on name and path, so matching the route's cookies by
name alone dropped our clear when the route set the same name on another
path. Sending our headers before the route's lets the later Set-Cookie win
for the same name and path, without parsing them.

* Never send a refreshed token when the route sets its own

Sending the refreshed token first and letting the route's logout cookie
override it still put a freshly minted, unrevoked JWT on the wire, and
clients such as Python's http.cookiejar keep it because they don't apply
Set-Cookie headers in order.

(cherry picked from commit ea2aae7)
@shahar1
shahar1 marked this pull request as ready for review October 29, 2026 07:45
@shahar1
shahar1 marked this pull request as draft October 29, 2026 07:45
@shahar1
shahar1 marked this pull request as ready for review October 30, 2026 05:51
@shahar1
shahar1 marked this pull request as draft October 30, 2026 05:51
@vatsrahul1001
vatsrahul1001 force-pushed the v3-4-test branch 2 times, most recently from 10eae22 to e63e6bb Compare November 4, 2026 09:12
@shahar1
shahar1 marked this pull request as ready for review November 6, 2026 07:27
@shahar1
shahar1 enabled auto-merge (squash) November 6, 2026 08:36
@shahar1
shahar1 disabled auto-merge November 6, 2026 09:09
@shahar1
shahar1 enabled auto-merge (squash) November 6, 2026 09:09
@shahar1
shahar1 merged commit 818f86b into apache:v3-4-test Nov 6, 2026
66 checks passed
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