2
我使用csp头保护我的页面。我同时设置了X-Content-Security-Policy
和X-Webkit-CSP
。到以下值:允许某些脚本设置内联样式
default-src 'self';
object-src 'none';
frame-src 'self' *.youtube.com;
style-src 'self' https://ajax.googleapis.com;
script-src 'self' https://ajax.googleapis.com;
report-uri /csp_report
一切正常加载,但我得到在铬下面的错误。我还没有在其他浏览器中测试它。
Refused to apply inline style because it violates the following Content
Security Policy directive: "style-src 'self' https://ajax.googleapis.com".
指在当前域的脚本行,这是试图插入含内嵌样式一些HTML。有没有办法允许我使用script-src列入白名单的脚本来执行此操作?我在jquery上收到了与ajax.googleapis.com上托管的相同的错误。
不安全的内联是不是一个“解决方案”,因为它只是规避每个人的安全政策,是一样的,在第一没有一个地点。 –