Requires csp policy to allow "data:" because of the two background-image urls used for hover and active buttons.
See original GitHub issueSweetalert2 is great, but it uses some background-image
data URLs to darken the button backgrounds on hover and when active:
.swal2-popup .swal2-actions:not(.swal2-loading) .swal2-styled:hover {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNikAQAACIAHF/uBd8AAAAASUVORK5CYII="); }
.swal2-popup .swal2-actions:not(.swal2-loading) .swal2-styled:active {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNiMAYAADwANpiOMBYAAAAASUVORK5CYII="); }
The upshot of this is that it requires the contentSecurityPolicy header to explicitly allow data:
for the img-src
policy. Is there any chance you would consider implementing a different way of darkening the images? I am worried about the implications of allowing data:
for the img-src
policy, for instance:
Maybe I am being too paranoid but wanted to raise the issue that using sweetalert2 requires a potential change to the content security policy header.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Content security policy blocking remote CSS background image
I assume it doesn't like url(... , but the CSP spec doesn't seem to consider url() a scheme so I can't see what...
Read more >Using Content Security Policy (CSP) to Secure Web Applications
This article shows how to use CSP headers to protect websites against XSS attacks and other attempts to bypass same-origin policy.
Read more >Third party CSS is not safe | Tan Li Hau
Recently, I read Jake Archibald's "Third party CSS is not safe", and it has a lot to say about why 3rd party CSS...
Read more >Creating Content - Oracle Help Center
Open the first guide (from which you want to link) in the editor; select the step after which the second guide should launch...
Read more >Microsoft Edge Browser Policy Documentation
You can use these policies to configure how Microsoft Edge runs in your ... AutomaticDownloadsAllowedForUrls, Allow multiple automatic ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thoughts?
Demo: https://jsfiddle.net/kxxc7kxh/1/
No worries, thanks for fixing! Awesome!