Repository navigation
[py] Align _cookie_matches domain and path matching with RFC 6265 - #18238
Merged
cgoldberg merged 3 commits intoOct 25, 2026
Merged
Conversation
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
1. In domain matching, strip any optional leading dot per RFC 6265 §5.1.3 so cookies with domain 'example.com' match subdomains (e.g. sub.example.com). 2. Canonicalize cookie domain and request hostname to lowercase for case-insensitive domain matching. 3. In path matching, handle cookie paths with trailing slashes (e.g. /docs/) so that subpaths (e.g. /docs/page) match correctly instead of attempting a prefix match against double slashes (/docs//).
saiyam-jain-dev
force-pushed
the
fix-cookie-matches-rfc6265
branch
from
October 25, 2026 06:48
88e3705 to
38efcb9
Compare
cgoldberg
self-requested a review
October 25, 2026 15:41
Member
|
this branch failed the formatter and linter. I just pushed a commit to it that fixes formatting and simplifies one line of code so it passes: bc65d1e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses two RFC 6265 compliance issues in _cookie_matches in selenium.webdriver.common.api_request_context:
Description
This PR addresses two RFC 6265 compliance issues in
_cookie_matchesinselenium.webdriver.common.api_request_context:Domain matching without leading dot & case insensitivity (RFC 6265 ?5.1.3):
domain="example.com"matchessub.example.com). Previously, cookies withdomain="example.com"only matchedexample.comexactly.Path matching with trailing slash (RFC 6265 ?5.1.4):
path="/docs/"), subpaths likepath="/docs/page"previously failed because_cookie_matchestestedpath.startswith(cookie_path + "/")(which evaluated to"/docs//", causing a false mismatch). We now check ifcookie_path.endswith("/")andpath.startswith(cookie_path)before appending a slash.Motivation and Context
Ensures
APIRequestContextaccurately matches browser cookies according to RFC 6265 specification, preventing cookies from being dropped on subdomain or subpath requests.Types of changes
Checklist