Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mgalla10 opened this issue Jul 8, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mgalla10
Copy link

mgalla10 commented Jul 8, 2024

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

@mgalla10 mgalla10 added the bug Something isn't working label Jul 8, 2024
@leonidukg
Copy link

See #4154 (comment)

@mgalla10
Copy link
Author

@leonidukg Thank you! Using CDP to remove the cookie storage data for the partitioned cookie's domain works as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants