MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: DeleteCookie / DeleteCookies / DeleteCookiesWithDomainAndPath won't delete partitioned cookies

Open
#4,669 3 comments 0 reactions 1 assignee View on GitHub

@peiche-ms is already working on this.

Since Jul 8, 2024.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Third-party websites may add cookies that are partitioned, as part of Chromium's CHIPS pattern. I've attempted to remove these cookies via the CoreWebView2CookieManager's DeleteCookie, DeleteCookies, and DeleteCookiesWithDomainAndPath APIs, but none of these will remove them. Only DeleteAllCookies successfully removes partitioned cookies, at the cost of also removing other cookies we'd prefer to keep.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

126.0.2592.87

SDK Version

1.0.2535.41

Framework

Winforms

Operating System

Windows 11

OS Version

10.0.22631

Repro steps

Navigate to any website hosted by a WebView2 Winforms app. Open DevTools and enter the following commands in the console to add a normal and persistent cookie:

  • cookieStore.set({ name: "Normal-Cookie", value: "normal-value", secure: true, path: "/", sameSite: "none" })
  • cookieStore.set({ name: "Partitioned-Cookie", value: "partitioned-value", secure: true, path: "/", sameSite: "none", partitioned: true })

Still in DevTools, go to the Application tab, find your website's domain under the Cookies section, and note the cookie(s) you added.

In your WebView2 logic, obtain the cookie via the CoreWebView2CookieManager's GetCookiesAsync API, then attempt to remove it by using either the DeleteCookie, DeleteCookies, or DeleteCookiesWithDomainAndPath APIs.

Back in DevTools, refresh the cookies for your website. Notice that the while the normal cookie was removed, the partitioned cookie was not.

If you run the same workflow but clear the cookies using DeleteAllCookies, both the normal and partitioned cookies will be gone.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.