93823[BUGFIX] Sanitize and size SVG via dedicated SvgDocument classes
Commit message
Review
-
Code review CR +2 Done
- Georg Ringer +2
- Garvin Hicking +1
- Simon Schaufelberger +1
-
Verified V +2 Done
- Georg Ringer +2
- Oliver Klee +1
- Garvin Hicking +1
- Simon Schaufelberger +1
- core-ci +1 CI
Issues 1
Files 19
- typo3/sysext/backend/Classes/ViewHelpers/LoginLogoViewHelper.php+13 −30
- typo3/sysext/core/Classes/Imaging/Exception/InvalidSvgException.phpnew+25 −0
- typo3/sysext/core/Classes/Imaging/IconProvider/AbstractSvgIconProvider.php2+22 −7
- typo3/sysext/core/Classes/Imaging/Svg/SvgDocument.phpnew+32 −0
- typo3/sysext/core/Classes/Imaging/Svg/SvgDocumentFactory.phpnew+99 −0
- typo3/sysext/core/Classes/Imaging/Svg/SvgDocumentService.phpnew+195 −0
- typo3/sysext/core/Classes/Imaging/SvgManipulation.phpdeleted+0 −196
- typo3/sysext/core/Classes/Resource/Processing/SvgImageProcessor.php2+29 −24
- typo3/sysext/core/Classes/Resource/Security/SvgSanitizer.php+12 −1
- typo3/sysext/core/Classes/Type/File/ImageInfo.php2+19 −22
- typo3/sysext/core/Classes/ServiceProvider.php+38 −0
- typo3/sysext/core/Configuration/Services.php+5 −0
- typo3/sysext/core/Tests/Functional/Imaging/IconProvider/SvgIconProviderTest.php+3 −3
- typo3/sysext/core/Tests/Functional/Imaging/IconProvider/SvgSpriteIconProviderTest.php+3 −3
- typo3/sysext/core/Tests/Functional/Resource/Security/SvgSanitizerTest.php+39 −0
- typo3/sysext/core/Tests/Unit/Imaging/Svg/SvgDocumentFactoryTest.phpnew+129 −0
- typo3/sysext/core/Tests/Unit/Imaging/Svg/SvgDocumentServiceTest.phpnew+246 −0
- typo3/sysext/core/Tests/Unit/Type/File/ImageInfoTest.php+3 −1
- typo3/sysext/frontend/Classes/ContentObject/ScalableVectorGraphicsContentObject.php+16 −11
Review log 2333
Show 58 earlier messages
-
Benni Mack uploaded patch set 1 04/23/26, 09:44
-
core-ci voted on patch set 1 V -1 04/23/26, 10:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101017
-
Garvin Hicking uploaded patch set 2
V -105/29/26, 08:58Prevent DI where not possible -
core-ci voted on patch set 2 V -1 05/29/26, 09:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102596
-
Garvin Hicking uploaded patch set 3
V -105/29/26, 09:19 -
core-ci voted on patch set 3 V +1 05/29/26, 09:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102599
-
Christian Kuhn commented on patch set 3 05/29/26, 12:45
AbstractSvgIconProvider.php:64that's not correct, is it?! inject*() does work in abstracts, that's the (nearly sole) useful purpose of inject* methods: use it in abstracts so an abstract does not pollute __construct().SvgImageProcessor.php:98what blocks it? i don't see a reason quickly.ImageInfo.php:139probably DI as well. -
Christian Kuhn commented on patch set 3 CR -1 05/29/26, 14:09
on it.
-
Christian Kuhn uploaded patch set 4
CR -1V +105/29/26, 17:43 -
core-ci voted on patch set 4 V -1 05/29/26, 17:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102625
-
Christian Kuhn uploaded patch set 5
V -105/29/26, 18:12 -
core-ci voted on patch set 5 V -1 05/29/26, 18:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102626
-
Christian Kuhn uploaded patch set 6
V -105/29/26, 18:31 -
core-ci voted on patch set 6 V -1 05/29/26, 18:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102627
-
Christian Kuhn commented on patch set 6 05/29/26, 20:36
SvgImageProcessor.php:98ReplyDoneImageInfo.php:139Replyactually not: ImageInfo extends FileInfo extends \SplFileInfo, which is a data object with __construct() for the file-path. So ImageInfo and FileInfo blend service aspects into a data object, should be considered broken, needing refactoring. I'll add a @todo. -
Christian Kuhn uploaded patch set 7
V -105/29/26, 20:37 -
Christian Kuhn commented on patch set 7 CR -1 05/29/26, 20:38
getting closer, but still fiddling with some details. -
core-ci voted on patch set 7 V -1 05/29/26, 20:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102631
-
Christian Kuhn uploaded patch set 8
CR -1V -105/30/26, 00:50 -
Christian Kuhn commented on patch set 8 05/30/26, 00:52
AbstractSvgIconProvider.php:64ReplyDone: Using inject() methods in abstract now. added a compiler pass to 'public:true' all classes that implement IconProviderInterface to not break existing custom consumers. -
core-ci voted on patch set 8 V -1 05/30/26, 00:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102642
-
Christian Kuhn uploaded patch set 9
V -105/30/26, 01:28 -
core-ci voted on patch set 9 V +1 05/30/26, 01:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102645
-
Christian Kuhn uploaded patch set 10
V +105/30/26, 01:55 -
Christian Kuhn commented on patch set 10 CR +1 05/30/26, 01:56
This change is ready for review.Reply
DoneReply
Done -
Christian Kuhn commented on patch set 10 05/30/26, 01:56
+1 reading - i think i'm done with this for now. what do you think? -
core-ci voted on patch set 10 V +1 05/30/26, 02:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102647
-
Garvin Hicking commented on patch set 10 CR +1 V +1 05/30/26, 19:13
This (still) works for me. Thanks for brushing up the DI portion of this and also noticing more room for improvement. Also, I think the class structure is now really well designed and leaves us breathing room for refactoring and future enhancement. The type-hinting with the SvgDocument is clever. The object itselfs remains pure, a service class remains with pure application methods, and the factory only does factory stuff. For me, this is a general concept we need to enforce in TYPO3, because also LLM Agents will profit from clear structure and strong rules, and we can properly document this in an architecture file: "Have stateless services, pass objects to manipulation methods, abstain from fluent API in favor of clear cross-cutting concerns". This structure here would IMO be well applicable to the further GD/Image reworks of @benjamin.kott@outlook.com - we could similarly model the effect processing. I think a drawback of not having a fluent API is worth all the other upsides. I think having multiple views on this and creating multiple iterative improvements in this patch with a very clean outcome is worth having more discussion. I really hope that you, Benji, can also find peace with this variation of your work and it can be factored into your related chain/patches, and be a base for rework of those. I'm really sorry it has taken me very long to get into this patch due to "life reasons". I can see a lot of worth from the work you did in this area. I am sure we can move the other patches forward together. Getting of my soapbox: I think this patch is quite sound and I would have no objections to backport this to v14, probably even down to v13. Thanks! -
Oliver Klee voted on patch set 10 V +1 05/31/26, 09:42
-
Christian Kuhn wrote 06/18/26, 23:09
Removed reviewer Christian Kuhn with the following votes: * Code-Review+1 by Christian Kuhn -
Simon Schaufelberger voted on patch set 10 CR +1 V +1 06/23/26, 14:07
-
Georg Ringer voted on patch set 10 CR +2 V +2 07/10/26, 18:28
-
Georg Ringer merged patch set 11 07/10/26, 18:28