Skip to content

BUG1925390 Fix IPv6 session cookie matching - #455

Open
yunusarista wants to merge 1 commit into
bigswitch:mainfrom
yunusarista:BUG1925390
Open

BUG1925390 Fix IPv6 session cookie matching#455
yunusarista wants to merge 1 commit into
bigswitch:mainfrom
yunusarista:BUG1925390

Conversation

@yunusarista

Copy link
Copy Markdown

Login scoped the session cookie to urlparse(url).hostname. For IPv6 literal URLs, urlparse strips the brackets from the hostname, while requests matches cookies against the bracketed request authority. The mismatch caused the login cookie to be stored but not sent on later API requests, resulting in 401 responses after a successful login.

Create the login cookie without an explicit domain so the dedicated requests.Session can send it for both IPv4 and IPv6 hosts. Add a regression test that prepares requests for IPv4 and bracketed IPv6 URLs and verifies the session cookie is attached.

Fixes: BUG1925390

Login scoped the session cookie to urlparse(url).hostname. For IPv6 literal URLs, urlparse strips the brackets from the hostname, while requests matches cookies against the bracketed request authority. The mismatch caused the login cookie to be stored but not sent on later API requests, resulting in 401 responses after a successful login.

Create the login cookie without an explicit domain so the dedicated requests.Session can send it for both IPv4 and IPv6 hosts. Add a regression test that prepares requests for IPv4 and bracketed IPv6 URLs and verifies the session cookie is attached.

Fixes: BUG1925390
@yunusarista
yunusarista marked this pull request as ready for review August 5, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant