Problem/Motivation
Using this module in combination with the Security Kit (SecKit) module and a Content Security Policy (CSP) prevents CKEditor from loading. The issue stems from the compiled JavaScript code for the accordion functionality, which utilizes eval() to execute the code. In production, the JavaScript is compiled in such a way that it relies on eval(), which is flagged as unsafe by CSP. As a result, the browser blocks the execution of this code for security reasons, preventing the CKEditor from loading at all.
Steps to reproduce
- Enable the CKEditor Accordion
- Install and enable the Security Kit
- Under Security Kit `/admin/config/system/seckit` > `Cross-site Scripting` > `Content Security Policy` check `Send HTTP response header` and add `script-src` to script-src
- Add accordion to the basic HTML format
- Then see that the script doesn't trigger as it fails the security policy and is deemed unsafe
Proposed resolution
Set the webpack configuration option "devtool" to something safer than eval(), such as 'source-map' or 'none'.
Remaining tasks
Review patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | ckeditor_accordion-3477046-5.patch | 447.33 KB | johnzzon |
Issue fork ckeditor_accordion-3477046
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
johnzzonThanks for the patch. I have this issue on a project and will try it out.
Adding static patch for composer workflows.
Comment #6
mordonez commentedThanks! Same problem, the patch works perfectly
Comment #7
jeroen dost commentedThe patch does not apply to version 2.3.0. Can someone post an updated patch? Or is the code already merged to version 2.3.0?
Thanks in advance
Comment #8
johnzzonYeah, the patch needs to be updated for 2.3.0. It has not been merged in 2.3.0 from what I can tell.
Comment #9
johnzzonHmm, upon closer inspection, there's no eval() left in 2.3.0 so maybe it has been fixed.
I can test it, possibly today.