-
Notifications
You must be signed in to change notification settings - Fork 333
SameSite attribute support for ResponseCookieCollection #299
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
Also it may solve #201 issue |
SameSite=None is still an early draft and breaks Safari. We can't merge that specific behavior until that gets worked out. |
There are many other places that need to be updated, such as exposing this option for several auth components that emit cookies. SameSite breaks OAuth and OIDC so they need to disable it. Null is OK for them only until the implied default becomes Lax.
AspNetKatana/src/Microsoft.Owin.Host.SystemWeb/SystemWebChunkingCookieManager.cs Line 170 in 40de801
AspNetKatana/src/Microsoft.Owin.Security/Infrastructure/AuthenticationHandler.cs Lines 216 to 220 in 40de801
AspNetKatana/src/Microsoft.Owin.Security.OpenIdConnect/OpenidConnectAuthenticationHandler.cs Lines 467 to 472 in 40de801
|
Hm. System.Web already contains SameSiteMode enum, but it is not available in Microsoft.Owin project.
I'm sorry. I don't quite get what is wrong. If you set to null(or just do nothing) then SameSite would not be included at all as it does right now. Default behavior with default options is not broken. |
System.Web.SameSiteMode was added in 4.7.2. Microsoft.Owin targets 4.5.0. We'd probably have to cross compile Microsoft.Owin.Host.SystemWeb to support that. The new SameSite behavior defined in https://tools.ietf.org/html/draft-west-cookie-incrementalism-00 is that Lax becomes the default and you have to specify None to opt out. That default would break OAuth and OIDC unless they opt out, and they can't opt out without breaking Safari. |
I'm going to merge this as is and keep iterating. Thanks for getting it started for us. |
I have added a way to set SameSite attribute value for Set-Cookie headers.
You can do so by setting
CookieOptions.SameSite
property to some non null value.If
CookieOptions.SameSite
property is null then SameSite attribute will not be added at all.I must point out that if you use
SameSiteMode.None
it will be set as SameSite=None.You can read about that behavior here and here