Fix host-only state on cookie expiration (#13674) by Dreamsorcerer · Pull Request #13675 · aio-libs/aiohttp · GitHub
Skip to content

Fix host-only state on cookie expiration (#13674) - #13675

Merged
Dreamsorcerer merged 2 commits into
3.15from
patchback/backports/3.15/9332972cfcb0f5a2b6677e7307819ab8f13b5d09/pr-13674
Sep 9, 2026
Merged

Dreamsorcerer merged 2 commits into
3.15from
patchback/backports/3.15/9332972cfcb0f5a2b6677e7307819ab8f13b5d09/pr-13674

Conversation

@Dreamsorcerer

Copy link
Copy Markdown
Member

(cherry picked from commit 9332972)

@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label Sep 9, 2026
@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Comment thread tests/test_cookiejar.py Outdated
@greptile-apps

greptile-apps Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5

No blocking failure remains.

The exercised expiration, path-specific persistence, and explicit-domain replacement flows behave correctly in the updated cookie jar.

T-Rex T-Rex Logs

What T-Rex did

  • Ran a standalone CookieJar regression probe against base bc24dc1 and the updated checkout, observing the updated checkout passed on descendant-path expiration, path-specific save/load, and explicit-Domain replacement.
  • Executed the CookieJar test suite with pytest in the adjusted environment and the suite completed with 101 passed.
  • Confirmed that the updated host-only identity preserves independent scope for same-named cookies across different paths.
  • In a separate contract-validation pass, the base probe leaked a root host-only cookie to the descendant and suppressed the /api Domain cookie, while the PR probe passed with no root host-only cookie and Domain replacement reached the subdomain; the narrow CookieJar suite also passed 101 tests.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Host-only marker was keyed too broadly, corrupting cookies sharing a name and domain

    • Bug
      • On base bc24dc15, a Domain cookie at /attacker with Max-Age=0 clears the host-only marker for a root host-only cookie of the same name; the root cookie is then sent to evil.auth.example.com. The same two-part marker also makes save/load and explicit Domain replacement incorrectly apply host-only state across different paths.
    • Cause
      • The previous host-only identity was (domain, name) rather than the cookie identity (domain, path, name).
    • Fix
      • ace78817 updates host-only marker creation, deletion, filtering, persistence, and explicit-Domain replacement to use (domain, path, name). It also reloads through update_cookies() while retaining the persisted morsel path.

    T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "Apply batched suggestions from code revi..." | Re-trigger Greptile

Comment thread CHANGES/13674.bugfix.rst
Comment thread tests/test_cookiejar.py Outdated
Comment thread tests/test_cookiejar.py Outdated
Comment thread tests/test_cookiejar.py Outdated
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
@codspeed

codspeed Bot commented Sep 9, 2026

Copy link
Copy Markdown

@Dreamsorcerer
Dreamsorcerer merged commit b477d8c into 3.15 Sep 9, 2026
48 checks passed
@Dreamsorcerer
Dreamsorcerer deleted the patchback/backports/3.15/9332972cfcb0f5a2b6677e7307819ab8f13b5d09/pr-13674 branch September 9, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant