浏览器控制台警告 A cookie associated with a cross-site resource at <URL> was set without the `SameSite` attribute

时间:2020-07-07 16:30:16   收藏:0   阅读:421

描述

浏览器控制台警告 A cookie associated with a cross-site resource at was set without the SameSite attribute

技术分享图片

参见Chrome Platform Statusstackoverflow - SameSite warning Chrome 77

简述一下,chrome 自 76 版起给 cookie 加了一个属性叫 SameSite,用于防止 CSRF 攻击。

技术分享图片

此属性用于限制第三方的 cookie,拥有三个值

Set-Cookie: CookieName=CookieValue; SameSite=Strict;
Set-Cookie: CookieName=CookieValue; SameSite=Lax;

导航到目标网址的 Get 请求只包括三种情况:

<a href="..."></a>

<link rel="prerender" href="..."/>

<form method="GET" action="...">
Set-Cookie: widget_session=abc123; SameSite=None; Secure

默认是 Lax,并且第三方如百度设置服务器时也不带这个 SameSite 的配置,所以暂时无解,我们也无法做什么。可以说这是 Chrome 在推行新的标准而做的努力,总之期待一下第三方的站点后续的改进吧。

技术分享图片

原文:https://www.cnblogs.com/everlose/p/13261433.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!