embedio icon indicating copy to clipboard operation
embedio copied to clipboard

Implement SameSite cookie attribute

Open AbeniMatteo opened this issue 4 years ago • 4 comments

SameSite attribute cannot be specified using Response.SetCookie() (System.Net.Cookie doesn't have the field). I've also checked HttpListenerResponse.AppendSetCookieHeader.

Side-notes: Firefox complains about not specifying SameSite or Secure attribute for cookies, even for localhost.

Cookie “sid” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite

Setting Secure removes the warning for unsecure http localhost. No warnings from Chrome. At the moment i'm still trying to understand the best approach.

AbeniMatteo avatar Jun 06 '20 09:06 AbeniMatteo

I'm actually getting a similar warning from the Brave browser that mentions Chrome intends to block these cookies in a future version. NOT getting this warning in Chrome.

"A cookie associated with a resource at http://localhost/ was set with SameSite=None but without Secure. A future release of Chrome will only deliver cookies marked SameSite=None if they are also marked Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032."

So is this a problem/feature-request for EmbedIO? @AbeniMatteo where (in the source code?) did you set Secure?

Joe118 avatar Jul 03 '20 17:07 Joe118

context.Response.SetCookie(new Cookie("name", "value") { Secure = true });

AbeniMatteo avatar Jul 03 '20 17:07 AbeniMatteo

Thanks, I'll add this to my embedding program.

Joe118 avatar Jul 03 '20 17:07 Joe118

OK so further investigation shows that the warning is caused by a session cookie named 'a_session_console', so its could possible be sent only when I have the console open.

This cookie is NOT sent from my code, it's somewhere in the session module -- I'll try to zero in on where in the code it's coming from:

ck1

Joe118 avatar Jul 03 '20 18:07 Joe118