Review main Merged

81316[BUGFIX] Add CKEditor5 migrator for {extraA,disa,a}llowedContent

Benjamin Franzke CR +2 V +2 Hard +348 −5 updated 10/06/23, 14:27

Commit message

Allowed content in CKEditor5 is to be configured via the
General HTML Support plugin option config.htmlSupport.
CKEditor4 style configs are now parsed and migrated.

Note that this config.htmlSupport only applies to elements that
are "known" to CKEditor5. Tags like "svg" or custom elements like
"<foo-bar>" are not configurable this way as `htmlSupport.(dis)allow`
can only handle elements that are defined in the CKEditor5 schema. [1]

Also reintroduce the default configuration that allows any class
and any attribute that starts with data- to be specified/preserved on
known tags. This was removed with #96874.

[1] https://ckeditor.com/docs/ckeditor5/latest/features/html/general-html-support.html#enabling-custom-elements

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 1622

  1. Benjamin Franzke uploaded patch set 1 10/04/23, 05:07

  2. core-ci voted on patch set 1 V -1 10/04/23, 05:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47378

  3. Benjamin Franzke uploaded patch set 2 V -1 10/04/23, 11:08

  4. core-ci voted on patch set 2 V +1 10/04/23, 11:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47391

  5. Benjamin Franzke uploaded patch set 3 V +1 10/05/23, 09:31

  6. Benjamin Kott voted on patch set 3 V +1 CR +1 10/05/23, 09:35

  7. core-ci voted on patch set 3 V +1 10/05/23, 09:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47432

  8. Benjamin Franzke rebased onto patch set 4 CR +1 V +1 10/06/23, 08:40

  9. Benjamin Franzke rebased onto patch set 5 10/06/23, 08:55

    Rebase
  10. core-ci voted on patch set 4 V -1 10/06/23, 08:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47460

  11. core-ci voted on patch set 5 V +1 10/06/23, 09:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47465

  12. Stefan Bürk voted on patch set 5 V +1 CR +1 10/06/23, 09:18

  13. Oliver Hader commented on patch set 5 10/06/23, 10:54

    ckeditor5.ts:253

    Should `key` be checked against prototype pollution like in JavaScriptHandler.js?

    Base.yaml:18

    Checked 👍 It was `extraAllowedContent: "*(*)[data-*]"` in TYPO3 v11
  14. Oliver Hader voted on patch set 5 V +1 10/06/23, 11:22

  15. Benjamin Franzke commented on patch set 5 10/06/23, 13:11

    ckeditor5.ts:253 Reply

    Hm, good question. I think I'd say: no Reason: https://github.com/TYPO3/typo3/blob/main/Build/Sources/TypeScript/core/java-script-item-processor.ts#L22 prohibts `'__proto__', 'prototype', 'constructor'` to be set on arbitrary objects, because the "issue" would be if some classes/objects could be altered with the JavaScriptModuleInstruction "assign". In this this case we create a cloned object (with a certain subfield changed), so I'd say it's fine to copy all properties. (as the resulting objects are never `new`ed). WDYT?

    Base.yaml:18 Reply

    Right – and just because I didn't mention that explicitly: `extraAllowedContent: "*(*)[data-*]"` would actually also work now, thanks to the migration, but I wanted to use the new syntax directly.
  16. Benjamin Franzke uploaded patch set 6 CR +1 V +1 10/06/23, 13:54

    Rebase
  17. core-ci voted on patch set 6 V +1 10/06/23, 14:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47498

  18. Oliver Hader commented on patch set 6 10/06/23, 14:02

    ckeditor5.ts:253 Reply

    As you found out (via Slack), it's not relevant here for `Object.keys`, `Object.values` or `Object.entries`.
  19. Oliver Hader voted on patch set 6 V +1 CR +1 10/06/23, 14:02

  20. Stefan Bürk voted on patch set 6 V +1 CR +1 10/06/23, 14:19

  21. Benjamin Franzke voted on patch set 6 V +2 CR +2 10/06/23, 14:21

  22. Benjamin Franzke merged patch set 7 10/06/23, 14:27