question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SameSite cookie management

See original GitHub issue

Has anyone looked at supporting the new stricter samesite cookie standard? Chrome has started enforcing the behavior, so I see following exception after /login: A cookie associated with a resource at http://localhost/ was set with SameSite=Nonebut withoutSecure. It has been blocked, as Chrome now only delivers cookies marked SameSite=Noneif they are also markedSecure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032.

After reviewing https://www.thinktecture.com/en/identity/samesite/prepare-your-identityserver/ I was able to modify the server to return SameSite=Lax without much effort, but it’s a simplistic approach. I assume a better implementation would be to allow the policy to be configurable.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
AleF83commented, Aug 6, 2020

I mean to add function to Config.cs that will parse json from file/env (like all other configurations) and then to merge the parsed object into the options argument of the AddCookie function.

0reactions
AleF83commented, Nov 5, 2020

So summarizing the issue. There are two ways to solve it.

  1. Leave cookie SameSite mode to default (None) and make calls the server via HTTPS protocol.
  2. Change cookie SameSite mode to Lax and use HTTP protocol. It can be done by setting the following in SERVER_OPTIONS_PATH env var
{
  "Authentication": {
    "CookieSameSiteMode": "Lax",
    "CheckSessionCookieSameSiteMode": "Lax"
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

SameSite cookies explained - web.dev
Introducing the SameSite attribute on a cookie provides three different ways to control this behaviour. You can choose to not specify the ...
Read more >
SameSite
SameSite prevents the browser from sending this cookie along with cross-site requests. The main goal is to mitigate the risk of cross-origin information ......
Read more >
SameSite Cookie Attribute Changes
Describes how browser changes, such as the SameSite cookie attribute, affects your web applications that embed content from third-party domains.
Read more >
Work with SameSite cookies in ASP.NET
Setting the SameSite property to Strict , Lax , or None results in those values being written on the network with the cookie....
Read more >
Get Ready for New SameSite=None; Secure Cookie Settings
In contrast, cookie access in a same-site (or "first party") context occurs when a cookie's domain matches the website domain in the user's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found