https://github.com/spatie/laravel-csp
https://github.com/frontegg/frontegg-vue
我需要帮助,
在我添加了 laravel csp 之后,前面的 egg vue 登录页面无法正常工作。
拒绝应用内联样式,因为它违反了以下内容安全策略指令:“style-src 'self' https://fonts.googleapis.com 'nonce-loop' 'unsafe-inline' nonce-loop”。请注意,如果源列表中存在哈希值或随机数值,则忽略“不安全内联”。
拒绝应用内联样式,因为它违反了以下内容安全策略指令:“style-src 'self' 'nonce-loop' 'unsafe-inline' nonce-loop”。请注意,如果源列表中存在哈希值或随机数值,则忽略“不安全内联”。
请帮忙解决这个问题?
// frontegg
$this->addDirective(Directive::SCRIPT, 'https://assets.frontegg.com');
$this->addDirective(Directive::CONNECT, 'https://frontegg.com');
$this->addDirective(Directive::CONNECT, 'https://app-g6y1wrdhmmrt.frontegg.com');
$this->addDirective(Directive::IMG, 'https://fronteggprodeustorage.blob.core.windows.net');
$this->addDirective(Directive::STYLE, 'unsafe-inline');
如错误消息和 https://www.w3.org/TR/CSP2/#directive-script-src 所说,如果指定哈希值或随机数,则不能指定“不安全内联”。您应该从策略中删除“nonce-loop”和 nonce-loop。如果你打算使用随机数,它们应该是随机的,并且随着每个有效载荷而变化。