-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatibility with strict CSPs #449
Comments
Worth mentioning if someone else stumbles across this; I'm currently (manually) creating hashes of the computed inline styles and using
Which can be used with the
|
+1 |
2 similar comments
+1 |
+1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
The solution here would be moving into a stylesheet instead of injecting the styles into the head, am I understanding it correctly? |
yes, dont bundle css you are already publishing the style.css file we can just import it the way makes more sense on our side. |
Either that so CSS bundling becomes a user concern, allowing sonner to piggyback off i.e. Vite's nonce support which would circumvent the issue, or by providing a similar nonce configuration inside of sonner itself. Personally I'd prefer the former so that all the nonce configuration can be centralized in the bundler. |
How are you using strict CSP for other library right now? Can you provide more about your setup? (framework, how nonce is passed) If we need to provide a unique I'd love to learn more about your setup and to see what we can adjust here |
Describe the feature / bug 📝:
Sonner does not work with strict CSPs as there's inline styles.
Steps to reproduce the bug 🔁:
style-src
directive set to anything other thanunsafe-inline
.I'm looking into some fixes, but in essence all styles have to be defined in stylesheets for other CSPs to work. If it's impractical to apply a fix, there's always the fork and modify path but having support baked in would be nice.
The text was updated successfully, but these errors were encountered: