Review main Merged

92592[BUGFIX] Prevent evaluating hidden TypoScript in backend modules

Garvin Hicking CR +2 V +2 Normal +205 −13 updated 02/09/26, 17:57

Commit message

The `SysTemplateRepository` fetches database records from sys_template
by checking the visibility context aspect. In the backend module,
this is set to 'includeHiddenContent: true' by default (greedy backend),
so that hidden records (or those with time restrictions) can always be
revealed.

This is important to be able to edit/modify the `sys_template` records,
and to enable/disable them, or put starttime/endtime on them.

But, hidden records should NOT be evaluated inside the modules:

* Active TypoScript
* Included TypoScript
* Constant Editor

In the context of these controllers, the visibility aspect is now
changed to 'includeHiddenContent: false' plus
'includeScheduledRecords: false'. Since this is done in three
controllers dealing with simulation, that assignment is done
in the `AbstractTemplateModuleController`, and called from
the specific three instances.

Tests are added to verify that the `SysTemplateRepository` properly
evaluates the contexts.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Eike Starkmann +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 9

Review log 2429

Show 34 earlier messages
  1. Garvin Hicking uploaded patch set 1 01/30/26, 16:15

  2. Garvin Hicking commented on patch set 1 01/30/26, 16:15

    NOTE: This bug is also present in 12.4. Even though the bug is annoying, a possible negative impact could be worse. So I'm seeing this for v13 and main scope only.
  3. Oliver Klee voted on patch set 1 CR +1 01/30/26, 16:16

  4. core-ci voted on patch set 1 V +1 01/30/26, 16:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94687

  1. Garvin Hicking updated the commit message in patch set 2 CR +1 V +1 01/30/26, 17:20

  2. Garvin Hicking commented on patch set 2 01/30/26, 17:21

    Will need to check if starttime/endtime is properly respected in backend context too (I guess not)
  3. Garvin Hicking voted on patch set 2 CR -1 01/30/26, 17:21

  4. core-ci voted on patch set 2 V +1 01/30/26, 17:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94692

  5. Oliver Hader commented on patch set 2 01/30/26, 17:34

    ActiveTypoScriptController.php:108

    `getAllTemplateRecordsOnPage` currently also resolves hidden records (they appear in the selector field in the backend)

    ConstantEditorController.php:89

    `getAllTemplateRecordsOnPage` currently also resolves hidden records (they appear in the selector field in the backend)

    TemplateAnalyzerController.php:92

    `getAllTemplateRecordsOnPage` currently also resolves hidden records (they appear in the selector field in the backend)
  6. Garvin Hicking uploaded patch set 3 CR -1 V +1 01/30/26, 19:50

  7. Garvin Hicking commented on patch set 3 01/30/26, 19:56

    ActiveTypoScriptController.php:108 Reply

    This should still work as it does not access the `getSysTemplateQueryRestrictionContainer` method of `SysTemplateRepository`, but rather its own raw query. And the selector should probably show access to every record as long as it is not deleted. Or did I misunderstand you? Thanks for checking! This drove me nuts today, I had two hours of test failures just because my tests messed with the "Context" singleton... %-)
  8. Garvin Hicking commented on patch set 3 01/30/26, 19:57

    Reply

    Narrator: It did not respect it. Tried to address it.
  9. core-ci voted on patch set 3 V +1 01/30/26, 19:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94702

  10. Markus Klein voted on patch set 3 CR +1 02/05/26, 13:37

  11. Hendrik Reimers voted on patch set 3 CR +1 02/08/26, 20:32

  12. Hendrik Reimers voted on patch set 3 V +1 02/08/26, 20:32

  13. Oliver Hader commented on patch set 3 02/09/26, 15:41

    AbstractTemplateModuleController.php:304

    I personally dislike, that the global `Context` singleton is updated with a specific visibility aspect, which is actually only meant to be applied for templates - but when assigned to `$context` becomes effective for anything else. I think a more explicit (but more complicated) approach would be to optionally forward the manipulated `VisibilityAspect` to each repository method.
  14. Oliver Hader commented on patch set 3 02/09/26, 15:42

    ActiveTypoScriptController.php:108 Reply

    True. I was wrong here. Hidden `sys_template` records should still appear in the selectors, that's fine.

    ConstantEditorController.php:89 Reply

    Done

    TemplateAnalyzerController.php:92 Reply

    Done
  15. Oliver Hader commented on patch set 3 02/09/26, 15:46

    AbstractTemplateModuleController.php:304 Reply

    I created a fork of your patch with adjustments, making the adjusted visibility aspect more explicit, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/92756/1..2
  16. Oliver Hader uploaded patch set 4 CR +1 V +1 02/09/26, 16:16

  17. Oliver Hader commented on patch set 4 CR +1 V +1 02/09/26, 16:18

    AbstractTemplateModuleController.php:304 Reply

    Done
  18. core-ci voted on patch set 4 V -1 02/09/26, 16:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95478

  19. Eike Starkmann commented on patch set 4 V +1 02/09/26, 16:55

    Looks good to me, i tested manually via patch. It also works under TYPO3 12
  20. Garvin Hicking commented on patch set 4 CR +1 V +1 02/09/26, 17:14

    AbstractTemplateModuleController.php:304 Reply

    Thanks Olly, just to state this here, I'm of course fine with the changes. My original intent was to manipulate this so that any future operations in context of the backend module would utilize that visibilityAspect. But I see that an explicit visibility assignment is better than an implicit one. Thanks for checking.
  21. Garvin Hicking commented on patch set 4 02/09/26, 17:18

    (Note, CI red is sadly due to a flakey test or CI issue, not related to this patch)
  22. Georg Ringer voted on patch set 4 CR +1 V +1 02/09/26, 17:19

  23. core-ci voted on patch set 4 V +1 02/09/26, 17:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95478

  24. Garvin Hicking commented on patch set 4 CR +2 V +2 02/09/26, 17:28

    thanks so much everyone 😊
  25. Garvin Hicking merged patch set 5 02/09/26, 17:57