内容安全策略允许采用内联样式,而不会出现不安全的内联
问题描述:
使用不带style-src'unsafe-inline'的内容安全策略,如何允许这样的样式?
Using content security policy without style-src 'unsafe-inline' how do you allow styles like this?
<span style="font-size: 16px;">Hello</span>
我尝试向他们添加一个随机数并将该随机数添加到CSP头中,但这似乎不起作用
I've tried adding a nonce to them and adding that nonce to the CSP header but that doesn't seem to work
<span style="font-size: 16px;" nonce="0611873de7e2db5985c289fdfa946caee2ae1860">Hello</span>
"style-src 'nonce-0611873de7e2db5985c289fdfa946caee2ae1860' 'self'"
是否有任何方法可以执行而无需添加'unsafe-inline'指令?
Is there any way to do this without adding the 'unsafe-inline' directive??
答
https://bugzilla.mozilla.org/show_bug.cgi?id=855326#c35 不支持样式属性的随机数
According to https://bugzilla.mozilla.org/show_bug.cgi?id=855326#c35 nonces for style attributes isn't supported