我正在从源中加载一个伪JS脚本,例如:
str(df)
'data.frame': 1577 obs. of 2 variables:
$ DATE: Date,format: "2016-02-01" "2016-02-01" ...
$ TIME: Factor w/ 1577 levels "00:01.3","00:01.7",..: 448 449 450 451 453 454 455 456 457 458 …
CSP标头设置为:
<script src="http://www.this-host.test/loadMe.js"></script>
由于脚本源来自其原始主机,并且script-src 'self' 'strict-dynamic' 'nonce-{randomString}';
标头允许该脚本源,因此CSP
应该加载并执行。
相反,我得到了:
loadMe.js
在Refused to load the script 'http://www.this-host.test/loadMe.js' because it
violates the following Content Security Policy directive: "script-src 'self' 'strict-dynamic' 'nonce-{randomString}';.
'strict-dynamic' is present,so host-based whitelisting is disabled.
和浏览器Macintosh; Mac OS X 10_15_2
上进行了测试。
我在Chrome/79.0.3945.117,Firefox/71.0
上没有收到此消息。
也许要注意,我正在本地进行测试。
无论如何,当Safari
标头允许从原始主机加载资源时,我不想使用nonce-{randomString}
。
对此有何想法?