内容安全策略自阻塞内联
根据我的经验,下面的标题在启用时会阻止页面上的内联脚本。
内容安全策略:default-src“self”
。
为什么内联代码不被视为“自身”?
我知道我可以使用随机数或其他解决方法来允许内联或移动到外部文件。我只是想知道为什么内联代码不被视为自我。
希望这是有道理的
In my experience, the header below, when enabled, blocks inline script on the page.
Content-Security-Policy: default-src 'self'
.
Why is inline code not considered "self"?
I know I can use nonce or other work arounds to allow inline, or move to external files. I'm just interested to know why inline code isn't considered self.
Hope that makes sense
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,内联代码被禁用,不仅仅是因为
default-src 'self'
。要启用内联代码,必须在script-src
中使用unsafe-inline
By default inline code is disabled, not just because of
default-src 'self'
. To enabled inline code one has to useunsafe-inline
inscript-src