Skip to content
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

Content Security Policy warnings when pasting images #1224

Open
p8 opened this issue Feb 6, 2025 · 0 comments
Open

Content Security Policy warnings when pasting images #1224

p8 opened this issue Feb 6, 2025 · 0 comments

Comments

@p8
Copy link

p8 commented Feb 6, 2025

When I comment out the default CSP (Content Security Policy) in a Rails application,

Rails.application.config.content_security_policy do |policy|
   # ...
   policy.img_src :self, :https, :data
   # ...
end

Pasting an image in the editor results in the following in the browser

Refused to load the image 'blob:' because it violates the following Content Security Policy directive: "img-src 'self' data:".
Refused to load the image 'blob:http://example.com/426e8cf7-faab-4141-87ad-8e30eb54ad6d' because it violates the following Content Security Policy directive: "img-src 'self', 'https', data:".

The warning can be fixed by adding :blob to the policy,

   policy.img_src :self, :https, :data, :blob

but that makes things less secure.

It would be nice, if we could tie blob to a URI, for example "blob:http://example.com" but that is not (yet) supported by the CSP standard.

Things still seem to work as expected even when warnings are show, and the images get uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant