SameSite=None and Secure
A cookie associated with a cross-site resource at http://baidu.com/ was set without the
SameSite
attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set withSameSite=None
andSecure
. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
如今,如果仅打算在第一方上下文中访问cookie,则开发人员可以选择应用两个设置(SameSite = Lax或SameSite = Strict)之一来阻止外部访问。但是,很少有开发人员遵循此推荐做法,从而使大量相同站点的Cookie不必要地暴露于诸如“跨站点请求伪造”攻击之类的威胁中。
为了保护更多网站及其用户,新的默认安全模型假定所有cookie都应受到保护,以防止外部访问,除非另有说明。开发人员必须使用新的cookie设置SameSite = None来指定cookie以进行跨站点访问。当存在SameSite = None属性时,必须使用附加的Secure属性,以便只能通过HTTPS连接访问跨站点cookie。这不会减轻与跨站点访问相关的所有风险,但可以提供针对网络攻击的保护。
除了直接的安全性好处外,跨站点cookie的显式声明还可以提高透明度和用户选择范围。例如,浏览器可以为用户提供细粒度的控件,以管理仅由单个站点访问的cookie和跨多个站点访问的cookie。
浏览器禁止写入cookie的时候,您可以在其中通过禁用它们
在地址栏中输入chrome://flags ,搜索SameSite,状态改为disabled
参考来自: https://stackoverflow.com/questions/60822936/where-to-add-samesite-none