如果cookie设置为samesite strict,是否可以使用javascript发送到另一个站点,就像使用javascript获取cookie并将其发送给其他用户一样?
发布于 2019-05-10 07:53:08
是的,同样的cookie可以使用javascript读取。因此它们像任何其他cookie一样容易受到XSS攻击。
你可以自己测试一下,在任何网站上打开chrome inspector并输入以下内容:
// Set cookie
document.cookie = 'auth=lol;samesite=strict';
// Read cookie
console.log(document.cookie); // "auth=lol"你可能在想httpOnly?设置httpOnly将阻止读取javascript,因此将阻止XSS。https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Security
https://stackoverflow.com/questions/56068896
复制相似问题