Review main Merged

88508[BUGFIX] Enable inline SVG support in typo3/html-sanitizer

Oliver Hader CR +2 V +2 Normal +64 −1 updated 07/26/25, 08:22

Commit message

Allows inline SVG nodes to pass through the typo3/html-sanitizer
component. SVG sanitization is delegated to enshrined/svg-sanitize.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Benjamin Franzke +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Benjamin Franzke +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 2534

Show 69 earlier messages
  1. Oliver Hader uploaded patch set 1 03/06/25, 11:37

  2. Oliver Hader uploaded patch set 2 03/06/25, 11:38

  3. Oliver Hader uploaded patch set 3 03/06/25, 11:47

  4. core-ci voted on patch set 1 V -1 03/06/25, 11:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75213

  5. core-ci voted on patch set 2 V -1 03/06/25, 11:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75214

  6. core-ci voted on patch set 3 V -1 03/06/25, 11:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75215

  7. Oliver Hader uploaded patch set 4 V -1 03/06/25, 12:02

  8. Jasmina Ließmann commented on patch set 3 CR +1 V +1 03/06/25, 12:03

    Works, thank you! :) The output of tests is as follows: ``` <p>Lorem ipsum dolor <a href="/">Link internal<span class="icon"><?xml version="1.0" encoding="UTF-8"?> <svg class="icon__svg" role="img" aria-hidden="true"> <use href="#icon" /> </svg> </span></a></p> ``` I'm wondering whether it might be possible to filter out the comment `<?xml version="1.0" encoding="UTF-8"?>` and the subsequent line break? Because there could be quite a lot of comments. If not, it's also okay.
  9. Jasmina Ließmann commented on patch set 4 V +1 03/06/25, 12:05

    Reply

    The latest patch sets have solved both of my issues.
  1. core-ci voted on patch set 4 V +1 03/06/25, 12:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75216

  2. Oliver Hader commented on patch set 4 03/06/25, 12:08

    Reply

    I've adjusted that with the recent patch-sets - the XML prolog is not output anymore. The inline SVG used in the backend login view, is passed through a custom cleanup process in `LoginLogoViewHelper`.
  3. Oliver Hader commented on patch set 4 03/06/25, 12:09

    Reply

    Done
  4. Oliver Hader updated the commit message in patch set 5 V +1 03/06/25, 14:36

  5. Oliver Hader updated the commit message in patch set 6 03/06/25, 14:37

  6. Simon Schaufelberger commented on patch set 6 03/06/25, 14:42

    DefaultSanitizerBuilderTest.php:172

    this line doesn't look right. The first svg tag is self closing and the second one is closing a non opened tag.
  7. core-ci voted on patch set 5 V +1 03/06/25, 14:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75225

  8. core-ci voted on patch set 6 V +1 03/06/25, 14:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75226

  9. Oliver Hader commented on patch set 6 03/06/25, 21:34

    DefaultSanitizerBuilderTest.php:172 Reply

    Thx & Good catch. I did not spot this earlier... The problem is located in Masterminds HTML Parser, when sanitizing the nodes. I've just created a fix there, see https://github.com/Masterminds/html5-php/pull/259
  10. Oliver Hader uploaded patch set 7 V +1 03/06/25, 21:50

  11. Oliver Hader commented on patch set 7 03/06/25, 21:52

    DefaultSanitizerBuilderTest.php:172 Reply

    I opted for removing empty svg nodes, since a release in the upstream package still might take some time.
  12. core-ci voted on patch set 7 V -1 03/06/25, 21:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75251

  13. Benjamin Franzke commented on patch set 7 03/07/25, 08:15

    DefaultSanitizerBuilder.php:82

    It would be cool to avoid save-parse-save here, and directly hand over the `DOMNode` to the svg sanitizer. I know svg sanitizer does not allow that directly, but it is possible (when we allow ourselves to extend the svg sanitizer class). Pushed a demo here, what do you think? > 88524: [WIP] demo svg sanitize without save-load-save | https://review.typo3.org/c/Packages/TYPO3.CMS/+/88524
  14. Oliver Hader uploaded patch set 8 V -1 03/07/25, 08:30

  15. core-ci voted on patch set 8 V +1 03/07/25, 08:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75277

  16. Oliver Hader commented on patch set 8 03/07/25, 08:41

    DefaultSanitizerBuilder.php:82 Reply

    I think, that functionality should be part of the SVG sanitizer directly - instead of copy-pasting sanitization logic from SVG sanitizer on our side.
  17. Jasmina Ließmann commented on patch set 8 07/15/25, 12:11

    DefaultSanitizerBuilder.php:82 Reply

    Has there been a decision on this yet? It would be great if the patch could continue 😊
  18. Oliver Hader uploaded patch set 9 V +1 07/25/25, 06:18

  19. Oliver Hader commented on patch set 9 07/25/25, 06:20

    DefaultSanitizerBuilder.php:82 Reply

    I merged Ben's adjustments into this change, since it's working solution and is more efficient than my first approach.
  20. core-ci voted on patch set 9 V +1 07/25/25, 06:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82300

  21. Benjamin Franzke voted on patch set 9 CR +1 V +1 07/25/25, 06:34

  22. Simon Schaufelberger voted on patch set 9 CR +1 V +1 07/25/25, 08:54

  23. Simon Schaufelberger commented on patch set 9 07/25/25, 10:16

    DefaultSanitizerBuilderTest.php:172 Reply

    It has finally been released!
  24. Oliver Hader voted on patch set 9 CR +2 V +2 07/26/25, 08:22

  25. Oliver Hader merged patch set 10 07/26/25, 08:22