Review main Merged

69809[TASK] Introduce SVG Sanitizer

Oliver Hader CR +2 V +2 Expert +1803 −1 updated 07/12/21, 21:53

Commit message

This change introduces behavior of extension `t3g/svg-sanitizer` into
the TYPO3 core. Sanitizing SVG data is actually done by external package
`enshrined/svg-sanitize` by Daryll Doyle.

The following aspects are introduced:
+ handle `GeneralUtility::upload_copy_move` invocations
+ handle FAL action events `file-add`, `file-replace`, `set-content`
+ provide upgrade wizard, sanitizing all SVG files in storages that
  are using `LocalDriver`

Custom usage:
```
$sanitizer = new \TYPO3\CMS\Core\Resource\Security\SvgSanitizer();
$sanitizer->sanitizeFile($sourcePath, $targetPath);
$svg = $sanitizer->sanitizeContent($svg);
```

Basically this change enforces following public service announcements
concerning SVG files, to enhance these security aspects per default:
+ https://typo3.org/security/advisory/typo3-psa-2020-003
+ https://typo3.org/security/advisory/typo3-psa-2019-010

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Oli Bartsch +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Oli Bartsch +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 53

Show 33 more files

Review log 2436

Show 611 earlier messages
  1. Oliver Hader uploaded patch set 1 07/11/21, 12:18

  2. core-ci voted on patch set 1 V -1 07/11/21, 12:36 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13187

  3. Oliver Hader uploaded patch set 2 07/11/21, 12:38

  4. core-ci voted on patch set 2 V -1 07/11/21, 12:52 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13188

  5. Oliver Hader uploaded patch set 3 07/11/21, 13:23

  6. Oliver Hader updated the commit message in patch set 4 07/11/21, 13:30

  7. core-ci voted on patch set 3 V +1 07/11/21, 13:35 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13189

  8. core-ci voted on patch set 4 V +1 07/11/21, 13:41 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13190

  9. Oliver Hader updated the commit message in patch set 5 07/12/21, 08:31

  10. core-ci voted on patch set 5 V +1 07/12/21, 08:44 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13206

  11. Benni Mack commented on patch set 5 07/12/21, 09:18

    EventListener.php:24

    seems a like a bit of a generic name :D I also recommend removing the "Svg" namespace and rename "Sanitizer" to "SvgSanitizer" then.

    ext_localconf.php:5

    use ::class syntax for GeneralUtility
  1. Christian Kuhn commented on patch set 5 07/12/21, 09:41

    typo3/sysext/core/Tests/Functional/Resource/Fixtures/DirtySVG/useDosTwo.svg (unable to comment inline) - do we really needs such a huge fixture file? That's 100k lines, all php core codelines together have 500k (?) as comparison. Which scenario is covered with that file? Could we pinpoint it with a reduced test set or multiple files, maybe? Not a critical thing and if the answer is "screw it, keep it as is", I can live with it ... just asking.
  2. Oliver Hader uploaded patch set 6 07/12/21, 09:45

  3. Oliver Hader uploaded patch set 7 07/12/21, 09:47

  4. Oliver Hader commented on patch set 7 07/12/21, 09:47

    EventListener.php:24 Reply

    Ack

    ext_localconf.php:5 Reply

    Ack
  5. Oliver Hader commented on patch set 7 07/12/21, 09:48

    Reply

    It's checking for amplification DoS attack... I don't care if it would be removed.
  6. Oliver Hader uploaded patch set 8 07/12/21, 09:50

  7. Oliver Hader commented on patch set 8 07/12/21, 09:50

    Reply

    Removed it
  8. core-ci voted on patch set 8 V -1 07/12/21, 10:06 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13216

  9. core-ci voted on patch set 7 V -1 07/12/21, 10:06 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13215

  10. core-ci voted on patch set 6 V -1 07/12/21, 10:06 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13214

  11. Oliver Hader uploaded patch set 9 07/12/21, 10:08

  12. core-ci voted on patch set 9 V -1 07/12/21, 10:25 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13217

  13. Oliver Hader uploaded patch set 10 07/12/21, 10:38

  14. core-ci voted on patch set 10 V +1 07/12/21, 10:50 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13220

  15. Benni Mack voted on patch set 10 CR +1 07/12/21, 11:05

  16. Oliver Hader commented on patch set 10 CR -1 07/12/21, 14:46

    adding Important.rst
  17. Oliver Hader uploaded patch set 11 07/12/21, 14:57

  18. core-ci voted on patch set 11 V +1 07/12/21, 15:07 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13246

  19. Oliver Hader voted on patch set 11 CR -1 07/12/21, 19:48

  20. Oliver Hader uploaded patch set 12 07/12/21, 19:54

  21. core-ci voted on patch set 12 V +1 07/12/21, 20:08 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13257

  22. Benni Mack voted on patch set 12 V +1 CR +1 07/12/21, 20:11

  23. Oli Bartsch voted on patch set 12 V +1 CR +1 07/12/21, 21:32

  24. Oliver Hader voted on patch set 12 V +2 CR +2 07/12/21, 21:53

  25. Oliver Hader merged patch set 13 07/12/21, 21:53