在我的 view.jsp 文件中,我使用“object”标签链接到另一个页面。它看起来像:
<object
data="https://thisIsAnExample"
height="540" style="overflow: hidden;" type="text/html" width="960">
</object>
但是当调用 View 时它会说:
Blockt from the Content Security Policy.
我已经尝试在 .jsp 文件的头部添加一些元数据,例如
<meta http-equiv="Content-Security-Policy" content="object-src 'https:/thisIsAnExample';">
或
<meta http-equiv="Content-Security-Policy" content="sandbox">
但是没有任何作用!
有什么建议吗?
谢谢!
最佳答案
<meta http-equiv>
当设计时存在 Content-Security-Policy header 时,不会影响 CSP。如果确实如此,那么能够注入(inject)内容的攻击者就可以覆盖内容安全策略并注入(inject)脚本。另请参阅https://stackoverflow.com/a/41345974/20394
您必须修改生成 Content-Security-Policy
的代码 header 添加 object-src喜欢
object-src https://thisIsAnExample;
请注意,引号不是必需的。
如果您的团队中有安全专家,请与他们交谈。
关于java - 在 JSP/Spring 中禁用内容安全策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48423972/