Skip to content

BUG1925390 Fix IPv6 session cookie matching - #455

Merged
yunusarista merged 2 commits into
bigswitch:mainfrom
yunusarista:BUG1925390
Aug 17, 2026
Merged

BUG1925390 Fix IPv6 session cookie matching#455
yunusarista merged 2 commits into
bigswitch:mainfrom
yunusarista:BUG1925390

Conversation

@yunusarista

Copy link
Copy Markdown
Contributor

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
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
Comment thread pybsn/__init__.py
@yunusarista
yunusarista merged commit 3072a11 into bigswitch:main Aug 17, 2026
12 checks passed
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.

2 participants