Skip to content

fix(network): treat loopback addresses as secure for cookies - #43136

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-43115
Oct 5, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-43115

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • isLocalHostname() now matches 127.0.0.0/8 and [::1] in addition to localhost and *.localhost, so Secure cookies are kept and sent over plain HTTP to loopback addresses, as browsers do.
  • Covers APIRequestContext cookie headers, request.cookies() and browserContext.cookies().

Fixes #43115

@yury-s Yury Semikhatsky (yury-s) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does webkit treat it as secure too?

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

7 flaky ⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:436 › should produce network events, routing, and annotations for Service Worker (advanced) `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/webmcp.spec.ts:216 › should scope tools to their frame `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`

52639 passed, 1270 skipped


Merge workflow run.

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit d0fd0f2 into microsoft:main Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

9035 passed, 1495 skipped


Merge workflow run.

tf4fun (tf4fun) added a commit to tf4fun/antnest-platform that referenced this pull request Nov 5, 2026
Playwright 1.64 includes upstream fix microsoft/playwright#43136:
APIRequestContext and cookies(httpURL) now treat 127.0.0.0/8 and [::1]
as local hostnames and send Secure cookies over loopback HTTP, matching
Chromium. The repo check that documented the old gap expects 401 and
fails with 200. The bridge stays: it still pins explicit session
cookies, derives the CSRF header and keeps maxRedirects at zero.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

[Bug]: Secure cookies are dropped over http for 127.0.0.1 and loopback addresses

2 participants