Reputation: 1228
I am using the spatie/laravel-csp package to set CSP headers in a Laravel application. But the inline style
could not be applied and refused with the following error.
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self.' 'nonce-TjpZGox5zGathTvJDeVMfxzHaOtWMc7v' 'unsafe-inline'".
Further detail.
What I have tried so far.
Upvotes: 0
Views: 1536
Reputation: 151
If you are using Laravel try specifying your webpack_nonce in the index.php file.
Upvotes: 0
Reputation: 2165
You can also do your CSP for styles by adding style-src 'self' 'unsafe-inline';
In your manifest file add this line :
"content_security_policy": "default-src 'self' style-src 'self' 'unsafe-inline';"
This will allow you to keep using the inline style in your extension.
Note: This is not recommended way to do style tag inline to prevent attacks.
Upvotes: -1