Content Security Policy violation because of empty style attribute style="" #7101
Unanswered
dandelionn
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've spent hours trying to fix this security issue:
I seems to happen because Mantine generates this empty style attribute on html elements (style="") and CSP Policy is not happy with it.
These are the values that I have configured in the Security Policy Header:
I am using:
"@mantine/core": "^7.13.5",
"next": "^14.2.17", with App Directory
I've tried using getStyleNonce property like this:
The only thing that worked is setting:
But it is not a solution because I check security issue using ZAP Scan:
Alert Detail:
default-src 'self'; script-src 'self' 'nonce-ZGE3MzQzNDgtNDkxMC00ZmYwLThkOWItZWY5ZTUwMmZlOWY1' 'strict-dynamic'; style-src 'self' 'unsafe-inline' 'strict-dynamic'; img-src 'self' blob: data:; font-src 'self'; object-src 'none'; frame-src 'self' https://js.stripe.com; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests;
How can I fix it?
Beta Was this translation helpful? Give feedback.
All reactions