noopener noreferrer
-
第一次碰到
noopener noreferrer
是来自eslint的报错:Prevent usage of unsafe target='_blank' (react/jsx-no-target-blank)
用了十几年的target="_blank" 突然间不安全了。
先了解一下这两个参数:
noopener
“Instructs the browser to open the link without granting the new browsing context access to the document that opened it — by not setting the Window.opener property on the opened window (it returns null).”
指示浏览器打开链接而不授予对打开它的文档的新浏览上下文访问权限 - 即不在打开的窗口上设置Window.opener属性(它返回null)。”noreferrer
“Prevents the browser, when navigating to another page, to send this page address, or any other value, as referrer via the Referer: HTTP header.”
“当导航到另一个页面时,阻止浏览器通过Referer:HTTP标头发送此页面地址或任何其他信息。”通常站长们是不会没事找事把危险网站链接到自己的网站上。我想这个漏洞是指,某一天原来安全的网站开始不老实了,或者被黑客控制了,这时就有问题了:
攻击者可以使用此功能将某些内容下载到你的设备,拦截正在发送的私人数据,更改丢弃的Cookie或将你的读者带到他们想要的任何页面。 所以,后果严重!还是不明白黑客怎么搞得,不用太难过,梵总我也不明白。专家都说了,就照着干吧!