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

  1. Enable the CKEditor Accordion
  2. Install and enable the Security Kit
  3. 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
  4. Add accordion to the basic HTML format
  5. 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.

CommentFileSizeAuthor
#5 ckeditor_accordion-3477046-5.patch447.33 KBjohnzzon
Command icon 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

jnpwebdeveloper created an issue. See original summary.

johnzzon changed the visibility of the branch 2.0.x to hidden.

johnzzon changed the visibility of the branch 2.0.x to active.

johnzzon’s picture

StatusFileSize
new447.33 KB

Thanks for the patch. I have this issue on a project and will try it out.

Adding static patch for composer workflows.

mordonez’s picture

Thanks! Same problem, the patch works perfectly

jeroen dost’s picture

The 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

johnzzon’s picture

Status: Needs review » Needs work

Yeah, the patch needs to be updated for 2.3.0. It has not been merged in 2.3.0 from what I can tell.

johnzzon’s picture

Hmm, upon closer inspection, there's no eval() left in 2.3.0 so maybe it has been fixed.

I can test it, possibly today.