96896[BUGFIX] Sanitize inline SVG nodes through public API
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
-
Verified V +2 Done
- Benjamin Franzke +2
- core-ci +1 CI
Issues 1
Files 5
Review log 2026
Show 1 earlier messages
-
Oli Bartsch uploaded patch set 1 10/20/26, 07:06
-
core-ci voted on patch set 1 V +1 10/20/26, 07:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111747
-
Benjamin Franzke commented on patch set 1 10/20/26, 07:21
Thanks for tackling this! FYI: `sanitizeDocument()` actually wasn't a copy, but didn't exist before. We added it to allow sanitizing existing documents in order to combine it with `typo3/html-sanitizer` without having to * write the SVG (that is embedded in HTML) to a string * parse it again as a svg-sanitzier document again * write it back to string * parse it again in order to reimport to the HTML document. Now, why I'm saying that: Can we actually rename our overwrite to something else that is less likely to be used by the upstream lib as well. e.g. `typo3SanitizeExistingDocument(…)`, instead of writing to string? I understand that this has the possibility that upstream goes to final at some point. We should have upstream our own addition (but olly and me missed it :\), but maybe we can try that this time. -
Oli Bartsch updated the commit message in patch set 2
V +110/20/26, 08:05 -
Oli Bartsch commented on patch set 2 10/20/26, 08:09
Reply
Thanks. Right. A rename would fix the fatal, but not the actual problem. 1.1.0 changed the pipeline itself. It now cleans first, then removes duplicate ids, and only then resolves and removes unsafe <use> elements (to measure the graph on what the browser renders). It also added a root-namespace check and fails closed. Our overridden method would keep the 1.0 order and skip those steps, so inline SVG would be sanitized weaker than uploaded files. Matching 1.1.0 would need version-dependent calls into protected internals (removeDuplicateIds()/removeUnsafeUseElements() don't exist in 1.0), and 13.4/14.3 must support both. So I'd keep the public sanitize() for the fix and backports (the cost is one serialize plus one parse per inline SVG). -
core-ci voted on patch set 2 V +1 10/20/26, 08:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111755
-
Benjamin Franzke commented on patch set 2 CR +1 10/20/26, 09:05
Reply
Ack, I see, thanks.DefaultSanitizerBuilderTest.php:177nitpick: this could demonstrate the fact that the SVG can come nested in other HTML elements. Like a wrapping `<div>` or alike. -
Oli Bartsch uploaded patch set 3
CR +1V +110/20/26, 09:15 -
Oli Bartsch commented on patch set 3 10/20/26, 09:17
DefaultSanitizerBuilderTest.php:177ReplyYep, good idea. -
core-ci voted on patch set 3 V +1 10/20/26, 09:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111774
-
Benjamin Franzke voted on patch set 3 CR +1 V +1 10/20/26, 18:50
-
Benjamin Franzke commented on patch set 3 10/20/26, 18:53
Scheduled a nightly test on this change which should now be green: https://git.typo3.org/typo3/CI/cms/-/pipelines/111917 Let's see… -
Torben Hansen commented on patch set 3 10/20/26, 18:56
Heads-up: enshrined/svg-sanitize 1.0.0 and 1.1.0 are vulnerable, 1.1.1 is the only fixed version. Once the advisory is in the DB, Composer will block these versions on update/require. We should bump the lock (and check the constraint allows 1.1.1) in all affected branches before that happens, to avoid issues like we had previously and had to release 13.4.36 and 14.3.7 to fix the issue. -
core-ci commented on patch set 3 10/20/26, 19:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111917
-
Benjamin Franzke commented on patch set 3 10/20/26, 19:07
Reply
sounds right, albeit for this case composer users would be allowed to upgrade, since we allow ^1.0, but it definitely makes sense to update the locked version for classic mode users. -
Oli Bartsch commented on patch set 3 10/20/26, 19:08
Reply
Sure, but they will get a fatal then. -
Oli Bartsch commented on patch set 3 10/20/26, 19:21
Reply
Nightly passed. Should we merge or wait for other reviews? -
Benjamin Franzke commented on patch set 3 10/20/26, 19:38
Reply
Well, I would have said "let's merge", but I think we should raise/pin to 1.1.1 as outlined by torben. Can you do that (sorry for the iterations)?Reply
yes, you are right. so we need to pin/raise anyway.Reply
Meanwhile I also try to upstream our sanitizeDocument addon in order to be able to remove the stringify/parse roundtrip later on: https://github.com/darylldoyle/svg-sanitizer/pull/130 -
Benjamin Franzke commented on patch set 3 10/20/26, 19:48
Reply
nvm, i'll just do it -
Benjamin Franzke uploaded patch set 4
CR +1V +110/20/26, 19:49 -
Benjamin Franzke updated the commit message in patch set 5 10/20/26, 19:51
-
Benjamin Franzke commented on patch set 5 10/20/26, 19:52
Reply
Done, will update cherry-picks as well. -
core-ci voted on patch set 4 V +1 10/20/26, 20:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111932
-
core-ci voted on patch set 5 V +1 10/20/26, 20:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111933
-
Benjamin Franzke voted on patch set 5 CR +2 V +2 10/20/26, 20:13
-
Benjamin Franzke merged patch set 6 10/20/26, 20:15