vue.js Laravel CSP(内容安全策略)前端UI集成问题

vxbzzdmp  于 2023-04-12  发布在  Vue.js
关注(0)|答案(1)|浏览(169)

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”。请注意,如果源列表中存在散列或随机数值,则忽略'unsafe-inline'。
拒绝应用内联样式,因为它违反了以下内容安全策略指令:“style-src 'self' 'nonce-loop' 'unsafe-inline' nonce-loop”。请注意,如果源列表中存在散列或随机数值,则忽略'unsafe-inline'。
请帮助如何解决此问题?

// 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');

check screenshot for more info

shyt4zoc

shyt4zoc1#

正如错误消息和https://www.w3.org/TR/CSP2/#directive-script-src所说,如果你指定hashes或nonces,你不能指定'unsafe-inline'。你应该从你的策略中删除'nonce-loop'和nonce-loop。如果你要使用nonces,它们应该是随机的,并且随着每个负载而变化。

相关问题