-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add support for the Partitioned cookie attribute #55371
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
Conversation
@blowdart I just left a comment on the issue you filed for this, but I'll repeat it here. Are we really doing this for an expired draft spec that's only supported by chromium-based browsers when the workaround is nearly as easy to use as the proposed API? New API: options.Cookie.Partitioned = true; Workaround: options.Cookie.Extensions.Add("partitioned"); We did approve the API, but we were a little rushed. And I don't think the workaround was ever demonstrated. The simplicity of the workaround really makes me want to hold off on this until the spec is final. |
I take your point about the spec, but it's one of those that is unlikely to change (in my opinion) now that cookie has full throttle committed to it. |
I'm guessing that was meant to be "chrome has full throttle committed to it". |
Mozilla views it positively (Basically we'll add it soon) Google started the staged rollout in chrome for 1% of users. although they stopped because regulators objected. |
} | ||
|
||
[Flags] | ||
private enum MessagesToLog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it matters here, as the enum isn't embedded in a type.
private enum MessagesToLog | |
private enum MessagesToLog : byte |
to make the enum smaller (1 byte vs. 4 bytes for int
(default)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I considered that, but decided against it for two reasons. First, I'm expecting there to be more flags in the future. I've already added one since the PR began. 😆 Second, I figured space saving was probably less valuable than simplified alignment on the stack (though I didn't measure).
...to support CHIPS (Cookies Having Independent Partitioned State). Fixes dotnet#53224 Fixes dotnet#55370
Force push is a trivial rebase on |
Go added it already. My vote is to do it now. |
Am I correct in understanding that it's almost been three months since this PR was opened and six months since the issue was filed and there hasn't been any movement on making this expired draft spec more real in that time? AFAICT, Chrome still hasn't blocked third-party cookies by default due to regulator objections. I didn't realize the regulators were involved in this situation when I first reviewed this PR, but knowing about this makes me even more hesitant to merge this. I can see why regulators might have something to say about Chrome blocking third-party cookies given Google could track you anyway unlike their advertising competitors. And I could see regulators' decisions about what cookies Google can block affecting the final design of CHIPS or a competing standard. It also appears that Firefox and Safari both still don't support CHIPS even though Firefox already partitions third-party cookies and Safari already blocks them. I would be for merging this if the spec was ratified. Or if Firefox or Safari implemented. Or maybe if Chrome actually did start blocking cookies by default. But it appears none of this has happened yet. Remember we're comparing options.Cookie.Partitioned = true; to options.Cookie.Extensions.Add("partitioned"); The only benefit to the new API is discoverability, but we don't even know if this is going to exist in 10 years. And anyone who needs this will probably search for "asp.net core partitioned cookie" will find https://stackoverflow.com/a/77846869/719967 I don't understand the rush. |
toLog |= MessagesToLog.SameSiteNotSecure; | ||
} | ||
|
||
if (options.Partitioned) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might also want to check for options.SameSite == SameSiteMode.None && options.Secure && !options.Partitioned
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
Warning: Cookies with the SameSite=None; Secure that do not also have the Partitioned attribute may be blocked in cross-site contexts on future browser versions. This behavior protects user data from cross-site tracking. See Cookies Having Independent Partitioned State (CHIPS) and Third-party cookies.
@blowdart Are you okay with me closing this? |
🤷♂️ |
We can always reopen it. |
...to support CHIPS (Cookies Having Independent Partitioned State).
Fixes #53224
Fixes #55370