Replies: 1 comment 1 reply
-
Hmm I was also hoping to find some guidance on whether it was okay to add But I guess if anyone else stumbles across this thread, this is what guidance I could find on this: I also tried just blocking it with my csp to see what happened, and my images seemed to load okay, (disclaimer: I'm not recommending this, I'm not sure of the implications) but obviously you do also get spammed with errors in the console as a consequence. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
When researching how to implement a proper img-src setting for an XSS-protective content-security-policy, a raised concern is to avoid putting "data:" in your img-src setting. (see the scheme-source entry at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/img-src)
With all the benefits of using the next/image component, I'm wondering if there's an alternative to the embedded src="data:image/svg+xml..." node that's added with the image.
Example of the inject code here:
(For clarity this concern is with next.js 10 and 11 - great job all around, keep up the amazing work!)
Describe the solution you'd like
A way to allow use next/image while avoiding the data: img-src override.
I'm certainly open to hearing why the MDN concern may be overblown as well (I've also noted a great many popular websites have this img-src data: setting applied to their CSP's)
Describe alternatives you've considered
The only (very obvious) alternative I can use is to avoid the next/image tag altogether and use a straight img tag.
Beta Was this translation helpful? Give feedback.
All reactions