Review main Merged

87164[BUGFIX] Restore setting default lib.parseFunc.allowTags / denyTags

Benni Mack CR +2 V +2 Normal +122 −0 updated 12/10/24, 10:28

Commit message

With #104220 a change of behaviour was introduced that no longer
sets `lib.parseFunc_RTE.allowTags = {$styles.content.allowTags}`.

If custom extensions like a sitepackage however previously used this
code:

```
lib.parseFunc.allowTags := addToList(wbr)
lib.parseFunc_RTE.allowTags := addToList(wbr)
```

then `addToList` would actually set the previously empty `allowTags`
ONLY to "wbr". This would then deny any tag besides "wbr", and not
just allow "wbr" additionally to the previous default.

This patch re-introduces the `allowTags=*` TypoScript definition,
so that it can be expanded. Also, it ensures that any setting like
`*,wbr` still enables wildcard parsing.

Tests are added to verify this functionality.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 2

Files 5

Review log 1721

  1. Benni Mack uploaded patch set 1 11/22/24, 09:00

  2. core-ci voted on patch set 1 V +1 11/22/24, 09:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70023

  3. Benjamin Franzke commented on patch set 1 11/22/24, 10:23

    ContentObjectRenderer.php:3157

    I think this is the correct approach (I remember that I discussed this with Garvin and suggested a similar approach – but I can not find it anymore) BUT, this actually needs a default `allowTags = *` in some global config in order for `addToList()` to actually trigger this case, or am I missing something? (I don't think we have that yet.)
  4. Benni Mack commented on patch set 1 11/22/24, 10:27

    ContentObjectRenderer.php:3157 Reply

    not necessarily. because we have $allowTags === [] below (around line 3317)
  5. Garvin Hicking commented on patch set 1 11/22/24, 13:25

    ContentObjectRenderer.php:3157 Reply

    This should probably work out, I'll try to find time to add a test case for this addToList(wbr) scenario. Thanks!
  6. Garvin Hicking uploaded patch set 2 V +1 11/25/24, 12:15

  7. core-ci voted on patch set 2 V -1 11/25/24, 12:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70134

  8. Garvin Hicking commented on patch set 2 11/25/24, 12:32

    ContentObjectRenderer.php:3157 Reply

    @ben@bnf.dev We discussed this in the merger meeting only via voice. I added some notes of this in https://review.typo3.org/c/Packages/TYPO3.CMS/+/86763 I've now added a test for this, which currently fails - because as Benjamin indicated, we are missing an `allowTags = *` definition. Without this, `addToList` will still have the issue that it resolves to only `wbr` in the example case, and not `*,wbr`. If that test is modified to include `allowTags = *` it would pass, which we would achieve by adding `allowTags = *` to the former place of `typo3/sysext/fluid_styled_content/Configuration/TypoScript/Helper/ParseFunc.typoscript` (see https://review.typo3.org/c/Packages/TYPO3.CMS/+/84824). I've added such a line to https://review.typo3.org/c/Packages/TYPO3.CMS/+/86763 again to show that this would no longer break tests (I removed `denyTags=*` which was the culprit of my previous approach). IMO there are two ways to address this: * Retroactively make https://forge.typo3.org/issues/104220 a breaking change and document that `addToList()` operations will fail now, when no `allowTags` has been set. * Re-introduce the `allowTags = *` definition together with this change and new tests which will properly accept a `*,xxx` definition. This is my preferred choice. @benni@typo3.org wdyt?
  9. Benni Mack commented on patch set 2 12/02/24, 18:16

    ContentObjectRenderer.php:3157 Reply

    I agree. let's go with the 2nd option (= your preferred choice)
  10. Garvin Hicking uploaded patch set 3 V -1 12/03/24, 10:50

    Unbreak tests specify commit message
  11. core-ci voted on patch set 3 V -1 12/03/24, 11:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70513

  12. Garvin Hicking uploaded patch set 4 V -1 12/03/24, 11:24

  13. core-ci voted on patch set 4 V +1 12/03/24, 11:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70521

  14. Garvin Hicking commented on patch set 4 CR +1 V +1 12/03/24, 13:01

    ContentObjectRenderer.php:3157 Reply

    Alright. I had to add fsc to the test to make the test pass. From my side, this one is good to go now.
  15. Benni Mack commented on patch set 4 12/04/24, 09:28

    ParseFunc.typoscript:36

    shouldn't we switch back to "allowTags = {$styles.content.allowTags}" the constants still exist. Even though I suggest to remove both options in FSC for v14 completely.
  16. Garvin Hicking commented on patch set 4 12/04/24, 17:00

    ParseFunc.typoscript:36 Reply

    t would effectively roll back the "trust" in HTMLSanitzer that was to be established with the related change in first place. Personally I would go with "*" here to establish this and be safe to remove it more easily, because we can continue to test this in real life. I haven't seen reports for 13.4.0 or 13.4.1 reporting trouble with allowTags (other than this one here), so I don't think a "full revert" of this is required.
  17. Benni Mack commented on patch set 4 12/04/24, 17:05

    ParseFunc.typoscript:36 Reply

    alright!
  18. Garvin Hicking commented on patch set 4 12/10/24, 08:26

    ContentObjectRenderer.php:3157 Reply

    Would like to resolve this, please get in touch if you feel otherwise @ben@bnf.dev
  19. Benjamin Franzke voted on patch set 4 CR +1 12/10/24, 10:14

  20. Benjamin Franzke voted on patch set 4 CR +2 V +2 12/10/24, 10:21

  21. Benjamin Franzke merged patch set 5 12/10/24, 10:28