70404[BUGFIX] Adjust default behavior of HTML sanitization in parseFunc
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Helmut Hummel +1
-
Verified V +2 Done
- Benni Mack +2
- Helmut Hummel +1
- core-ci +1 CI
Issues 1
Files 12
- typo3/sysext/core/Classes/Html/RteHtmlParser.php+2 −2
- typo3/sysext/core/Configuration/DefaultConfiguration.php+2 −1
- typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml+4 −1
- typo3/sysext/core/Documentation/Changelog/9.5.x/Important-94484-IntroduceHTMLSanitizer.rst+2 −2
- typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/SecurityTest.php+3 −2
- typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php+2 −2
- typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/Fixtures/FluidTemplate.html+3 −0
- typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php2+142 −10
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php1+19 −3
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php+4 −510
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTestTrait.phpnew+205 −0
- typo3/sysext/frontend/Tests/UnitDeprecated/ContentObject/ContentObjectRendererTest.phpnew+501 −0
Review log 2028
Show 23 earlier messages
-
Kevin Appelt uploaded patch set 1 08/10/21, 16:33
-
core-ci voted on patch set 1 V +1 08/10/21, 16:46 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14497
-
Kevin Appelt marked it work in progress 08/10/21, 17:07
-
Kevin Appelt marked it ready for review 08/10/21, 17:09
-
Kevin Appelt uploaded patch set 2 08/10/21, 17:13
-
core-ci voted on patch set 2 V -1 08/10/21, 17:15 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14501
-
Tomas Norre Mikkelsen commented on patch set 2 08/11/21, 12:12
I know it's still work in progress, but I have tried it out on a TYPO3 8.7.42 ELTS version and that is giving me the same errors as before. I'll dig more into this. Let me know if you need feedback on testing. I have 7 ELTS, 8 ELTS and TYPO3 10 installations with problems that might be solved by this. -
Oliver Hader uploaded patch set 3 08/12/21, 20:38
-
core-ci voted on patch set 3 V -1 08/12/21, 20:42 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14852
-
Oliver Hader commented on patch set 3 08/12/21, 20:43
Reply
The previous patch-set (PS 2) and the current one (PS 3) just relaxed the default behavior with using `stdWrap.parseFunc` directly via TypoScript. When wrapping content in `<f:format.html>` the default behavior is still the same. However, sanitization can now be disabled using ``<f:format.html htmlSanitize="0">` - which was not possible before via that Fluid view-helper - even `parseFuncTSPath=""` (empty value) again triggered the default behavior in `parseFunc`. -
Oliver Hader uploaded patch set 4 08/12/21, 20:46
-
Markus Klein updated the commit message in patch set 5 08/12/21, 20:50
-
core-ci voted on patch set 4 V -1 08/12/21, 21:08 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14854
-
core-ci voted on patch set 5 V -1 08/12/21, 21:22 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14855
-
Oliver Hader uploaded patch set 6 08/13/21, 05:55
-
core-ci voted on patch set 6 V -1 08/13/21, 06:23 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14878
-
Oliver Hader uploaded patch set 7 08/13/21, 07:23
-
core-ci voted on patch set 7 V +1 08/13/21, 07:41 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14886
-
Helmut Hummel commented on patch set 7 CR +1 08/14/21, 08:55
From what I understand, this change does what it advertises to doHtmlViewHelper.php:115Fluid populates the arguments with default values if not provided, so the null check here is obsoleteSecureHtmlRenderingTest.php:183I must be missing something here, but this expectation does not seem to avoid XSS -
Oliver Hader commented on patch set 7 08/14/21, 09:00
HtmlViewHelper.php:115ReplyAckSecureHtmlRenderingTest.php:183Reply UnresolvedCorrectly, due to `htmlSanitize` not being enabled per default anymore. This test case is just here, to explicitly "document" the behavior. The reason is, that `$this->createTextContentObjectWithCustomParseFunc` (see below) does not set `htmlSanitize = 1`, therefore the new default is to disable HTML sanitization and trigger a deprecation log in `ContentObjectRenderer::parseFunc`. -
Helmut Hummel commented on patch set 7 CR 0 08/14/21, 13:55
Unresolved
Thought about it a bit more. What do you think about my suggestions?HtmlViewHelper.php:102UnresolvedRe-thought this argument. What exactly is the use case? Which scenarios should be mitigated? If it is to not encode some HTML tags when an empty parseFuncTSPath is provided, this should rather be changed in ContentObjectRenderer::parseFunc directly by early returning when no configuration is provided. As the intention isn't to change the global default (invocation with no arguments should intentionally still calls the sanitizer), users would still need to adapt configuration, e.g. by disabling it in lib.parseFunc_RTE) So with or without the option, users who have special use cases need adapt something anyway, so it does not matter, whether they adapt the VH invocation, TypoScript or both. Additionally, if the VH invocation is touched anyway, it isn't a big deal to also provide a custom parseFuncTSPath with the required configuration. My conclusion is to not introduce a VH argument at allContentObjectRenderer.php:3353UnresolvedI'd add an additional (or maybe alternative) check here (with according deprecation message) and return early, when $conf is completely empty, because the result is the same as going through the function with no config. -
Oliver Hader commented on patch set 7 08/15/21, 14:25
Thanks Helmut for the feedback. I love the idea of returning early in `parseFunc` as this allows to provide the previous (intended?) behavior. It also would allow to keep `htmlSanitize` enabled per default - as it can be disabled via `stdWrap.parseFunc` or individual `parseFuncTSPath`. I've created a matrix showing the changes per version: https://docs.google.com/document/d/1mlw5gDOcFQERvMEdnJCPsFnq4E-3xDjqcIO8z5bip2A/edit?usp=sharing -
Oliver Hader uploaded patch set 8 08/16/21, 09:47
-
core-ci voted on patch set 8 V +1 08/16/21, 10:04 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15151
-
Benni Mack commented on patch set 8 V +1 CR +1 08/16/21, 10:21
Works properly in various backend and frontend rendering scenarios -
Helmut Hummel commented on patch set 8 V +1 CR +1 08/16/21, 11:18
Makes sense. Thanks for the updates! -
Benni Mack voted on patch set 8 V +2 CR +2 08/16/21, 11:21
-
Benni Mack merged patch set 9 08/16/21, 11:21