1、iframe被引用
判断top.location !== window.location,不一致则跳转其他页面
sandbox设置为空
2、opener问题
a链接设置rel="noopener noreferrer nofollow"
window.open则设置
function openurl(url) {
var newTab = window.open();
newTab.opener = null;
newTab.location = url;
}
3、CSRF(跨站请求伪造)
set-cookie设置SameSite为Strict,仅同源可访问cookie
验证请求头的referer,不是同个网站则拒绝
多设置token操作,token验证失败则拒绝
4、xss(跨站脚本攻击)
过滤提交的内容
设置http-only,让第三方拿不到cookie
5、CDN劫持
设置script的integrity属性,保证内容未被更改