Manual Crop uses inline Javascript in a few places, namely some "onmousedown" attributes and href="javascript:void(0)".
If your website uses a Content Security Policy (CSP) to prevent inline Javascript, then ManualCrop won't work, unless you're willing to add "script-src unsafe-inline" to your CSP configuration, which kind of defeats the point of CSP (because it won't be able to prevent XSS attacks anymore).
I'll post a patch in a moment that converts all the inline Javascript to non-inline code in the manualcrop.js and allows Manual Crop to work with CSP in my limitted testing.
Comments
Comment #2
dsnopekHere's a patch that's working in my limited testing! Please let me know what you think. Thanks!
Comment #3
cboyden commentedTesting this for #3177807: Manual Crop doesn't work with strong Content Security Policy. In the inline version, the button text changes from "Crop" to "Crop (cropped)" if a crop has been previously applied. This is lost with the non-inline version.
Comment #4
cboyden commentedThe CSP error that seems to be preventing this change is:
It's triggered when the page with the Crop button on it is loaded. Tested on the /file/FID/edit page and in the Media modal when uploading a new file using Media.
Comment #5
dsnopekIt looks like there were some inline "onchange" attributes that I missed in my first pass through the code. Here's a new patch!
Comment #6
cboyden commentedThanks for the update, this is working with our strict CSP settings now.