Review main Merged

93371[FEATURE] Make resources configurable

Helmut Hummel CR +2 V +2 Expert +1212 −222 updated 03/31/26, 05:51

Commit message

Introduce the possibility to configure resources for extensions
and the `typo3/app` package.

For now, this mainly affects additional public folders or single
files that are published automatically. In future TYPO3 versions,
the same mechanism can also be used for additional non-public
resources such as Fluid templates.

The change integrates with the system resource API and asset
publishing, so configured resource definitions are evaluated
and applied consistently.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 49

Show 29 more files

Review log 4663

Show 2538 earlier messages
  1. Helmut Hummel uploaded patch set 1 03/26/26, 15:29

  2. core-ci voted on patch set 1 V -1 03/26/26, 15:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98796

  3. Mathias Brodala commented on patch set 1 03/27/26, 06:52

    ❤️
  4. Helmut Hummel uploaded patch set 2 V -1 03/27/26, 10:45

  5. Helmut Hummel marked it work in progress 03/27/26, 10:45

  6. Helmut Hummel commented on patch set 2 03/27/26, 10:46

    Reply

    ❤️
  7. core-ci voted on patch set 2 V -1 03/27/26, 11:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98856

  8. Helmut Hummel uploaded patch set 3 V -1 03/27/26, 11:44

  9. core-ci voted on patch set 3 V -1 03/27/26, 12:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98858

  10. Helmut Hummel uploaded patch set 4 V -1 03/27/26, 12:49

  11. Helmut Hummel uploaded patch set 5 03/27/26, 12:59

  12. core-ci voted on patch set 4 V -1 03/27/26, 13:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98868

  13. core-ci voted on patch set 5 V -1 03/27/26, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98873

  14. Helmut Hummel uploaded patch set 6 V -1 03/27/26, 16:12

  15. core-ci voted on patch set 6 V -1 03/27/26, 16:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98897

  16. Helmut Hummel uploaded patch set 7 V -1 03/27/26, 16:43

  17. core-ci voted on patch set 7 V -1 03/27/26, 17:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98900

  18. Helmut Hummel uploaded patch set 8 V -1 03/28/26, 08:41

  19. core-ci voted on patch set 8 V +1 03/28/26, 08:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98942

  20. Helmut Hummel uploaded patch set 9 V +1 03/28/26, 18:41

  21. core-ci voted on patch set 9 V -1 03/28/26, 18:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98968

  22. Helmut Hummel uploaded patch set 10 V -1 03/28/26, 19:03

  23. core-ci voted on patch set 10 V +1 03/28/26, 19:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98969

  24. Helmut Hummel uploaded patch set 11 V +1 03/29/26, 13:38

  25. Helmut Hummel marked it ready for review 03/29/26, 13:41

  26. core-ci voted on patch set 11 V +1 03/29/26, 13:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98984

  27. Helmut Hummel updated the commit message in patch set 12 V +1 03/29/26, 13:58

  28. core-ci voted on patch set 12 V +1 03/29/26, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98985

  29. Garvin Hicking commented on patch set 12 03/29/26, 16:52

    Feature-109409-Allow-configuration-of-public-resources.rst:38

    ```suggestion If they do not, the following default configuration is used to define the paths "Configuration", "Resources/Private" and "Resources/Public": ```

    Feature-109409-Allow-configuration-of-public-resources.rst:67

    Please add a caption to this file (EXT:my_extension....)

    Feature-109409-Allow-configuration-of-public-resources.rst:90

    Caption here too

    Feature-109409-Allow-configuration-of-public-resources.rst:104

    Would this style.css then land in "_assets/471..../Build/styles.css" using the configured subdirs, right?maybe you find a simple sentence for this fact.

    Feature-109409-Allow-configuration-of-public-resources.rst:139

    ```suggestion .. important:: ```

    Feature-109409-Allow-configuration-of-public-resources.rst:145

    ```suggestion .. important:: ```

    Feature-109409-Allow-configuration-of-public-resources.rst:153

    I must admit this "typo3/app" thing could use a deeplink to explain what this package is

    Feature-109409-Allow-configuration-of-public-resources.rst:182

    ```suggestion .. important:: ```

    Feature-109409-Allow-configuration-of-public-resources.rst:189

    ```suggestion .. note:: ```

    Feature-109409-Allow-configuration-of-public-resources.rst:207

    I think this needs more explanation, like "don't perform any other logic operations, think of it a bit like ext_emconf.php or Persistence/Classes.php"?

    Feature-109409-Allow-configuration-of-public-resources.rst:210

    Probably also no DI usage? What happens if one does, could you give an example to a possible error message? That could then be found by google, I mean general stealing bots.

    Feature-109409-Allow-configuration-of-public-resources.rst:212

    ```suggestion .. important:: ```

    Feature-109409-Allow-configuration-of-public-resources.rst:217

    ```suggestion .. note:: ```
  30. Garvin Hicking commented on patch set 12 03/29/26, 17:29

    DefaultPackageResources.php:9

    We currently have: Configuration/Services.php: static function return (needs a lot of logic) Configuration/Icons.php: return [] Configuration/JavaScriptModules.php: return [] Configuration/ExpressionLanguage.php: return [] Configuration/RequestMiddlewares.php: return [] Configuration/TCA/: return [] Configuration/Extbase/Persistence/Classes.php: return [] Configuration/Backend/Routes.php: return [] Configuration/Backend/AjaxRoutes.php: return [] Configuration/Backend/Modules.php: return [] Configuration/Fluid/ComponentCollections.php: return [] Configuration/ContentSecurityPolicies.php: return object So I wonder, could we better use an array based syntax for this as well? I believe there should not really logic be needed (and if so, it could be utilized inside the array values). That would prevent people doing half-baked stuff and leave us with a configuration file where we could easier to dynamic migrations and parsing. We would have a "connector" that transforms the Array in the objects. I think integrators will have a far easier time to confiugre this due to "prior art" than introducing a complex file here. wdyt?
  31. Garvin Hicking commented on patch set 12 03/29/26, 17:31

    ```suggestion [FEATURE] Make asset publishing resources (dirs and files) configurable ``` Something maybe that will easier let people connect this change with "ah, it's `_assets` and Resources/Public".
  32. Garvin Hicking commented on patch set 12 03/29/26, 17:39

    Could we get a config overview ir CLI command that lists all actively configured locations? That might be very handy to see which extension registers which path/dir? (Can be a followup, but time is running away. So maybe a stub that we can improve as a task 🫣)
  33. Garvin Hicking commented on patch set 12 03/29/26, 17:43

    Reply

    (Something like for the registered fluid components or backend routes)
  34. Garvin Hicking commented on patch set 12 03/29/26, 17:45

    PackageCacheEntry.php:117

    Having an array could probably leave safer unserialization intact here too?
  35. Helmut Hummel commented on patch set 13 V +1 03/29/26, 18:01

    Published edit on patch set 12.
  36. Helmut Hummel commented on patch set 13 03/29/26, 18:01

    Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:38 Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:139 Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:145 Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:182 Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:189 Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:212 Reply

    Fix applied.

    Feature-109409-Allow-configuration-of-public-resources.rst:217 Reply

    Fix applied.
  37. Garvin Hicking commented on patch set 13 03/29/26, 18:09

    DefaultPublicPrefix.php:30

    Does this produce the same md5 asset checksum like before? Otherwise we need an info in the rest file because at least a couple of my projects where we resorted to referencing the md5 identifier for external JS/manifest files and could use a heads-up if this changes. :)

    Deprecation-109409-Access-of-arbitrary-resources-in-extentsions.rst:6

    filename has a typo "extentsion"
  38. core-ci voted on patch set 13 V +1 03/29/26, 18:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98991

  1. Helmut Hummel commented on patch set 13 03/29/26, 18:32

    Reply

    That's a brilliant idea, which I would love to postpone for a different change. whether it's part of v14 does not matter much as it can perfectly be delivered as third party extension.

    PackageCacheEntry.php:117 Reply

    we could save an array representation here, which we could then parse on runtime and save it to a cache, which would then serialize and unserialize without restrictions anyway. So I figured, since this is a cache as well, we could skip this safety net here as it does not really improve anything in practice. in fact, this one here ends up in vendor folder in composer based typo3 systems, which is more likely to be on a read only file system than var/cache

    DefaultPublicPrefix.php:30 Reply

    it does produce the exact same md5. at least it should. I will double check.

    DefaultPackageResources.php:9 Reply

    Then we need to invent a dsl for the arrays to represent conditions or glob syntax to represent multiple locations for example for fluid components each having a public css file or directory. it might suffice for basic use cases, but honestly the most basic use case is covered by not configuring anything, which worked for us for years. This file and this feature is for the more elaborate things.

    Deprecation-109409-Access-of-arbitrary-resources-in-extentsions.rst:6 Reply

    Acknowledged

    Feature-109409-Allow-configuration-of-public-resources.rst:90 Reply

    Acknowledged

    Feature-109409-Allow-configuration-of-public-resources.rst:104 Reply

    this example is wrong. I need to change it an check whether this configuration mistake will actually lead to an exception. thanks for spotting this. I came across this during development but forgot about it again.

    Feature-109409-Allow-configuration-of-public-resources.rst:153 Reply

    maybe link to system resources docs?

    Feature-109409-Allow-configuration-of-public-resources.rst:207 Reply

    I think a more elaborate example might be useful as well

    Feature-109409-Allow-configuration-of-public-resources.rst:210 Reply

    Think of it as plain standalone php file being executed. No makeInstance, just need. no constants and so on
  2. Garvin Hicking commented on patch set 13 03/29/26, 18:44

    Reply

    I'm not sure someone would install a third party ext to introspect/dump current config. But I guess adding this can be a task as well, at least for me, because it would be quite basic. And the backend route debug CLI commands are "internal" anyways.

    DefaultPackageResources.php:9 Reply

    Hm, but the changleog explicitly says "do not do more elaborate things here"? I just feel that TYPO3 often gets "the eye" for overcomplicating config or having X types of config syntax. And IMO the config here boils down to "insert path/file here" - but you might have a bigger picture in mind. So if everyone else is happy with a config file like now, I said my piece and am at peace (really). So leaving this resolved.

    Feature-109409-Allow-configuration-of-public-resources.rst:153 Reply

    I dont think we have these yet. So a changelog link to typo3/app would be great, also for later docs integration.

    Feature-109409-Allow-configuration-of-public-resources.rst:210 Reply

    And when it contains errors, the composer dumpautloload fails, as with any TYPO3 errors then right?
  3. Oliver Hader commented on patch set 13 03/29/26, 19:19

    PackageCacheEntry.php:117 Reply

    Please let's have a restriction here. `\TYPO3\CMS\Core\Serializer\PolymorphicDeserializer` might be used to support abstract classes and interfaces as well (in contrast to the native `unserialize` function in PHP). Thus, that would work in case user-land must must implement a particular interface.
  4. Helmut Hummel commented on patch set 13 03/30/26, 08:00

    PackageCacheEntry.php:117 Reply

    I can do so. I was not aware PolymorphicDeserializer exists. This looks pretty neat! Can you nevertheless outline more concrete reasons for this, especially in relation to what I wrote above? What is the difference in attack vectors comparing this cache to VariableFrontend https://github.com/TYPO3/typo3/blob/637842b66991716781e3b39280ee56605a17ac47/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php#L77 Or would you argue, that caching object in VariableFrontend should not be done either?
  5. Helmut Hummel commented on patch set 13 03/30/26, 08:01

    PackageCacheEntry.php:117 Reply

    Or what about caching plain PHP files (like for TCA, DI, ...) if an attacker can taint files on the filesystem, how are those files less exposed?
  6. Helmut Hummel commented on patch set 13 03/30/26, 08:05

    PackageCacheEntry.php:117 Reply

    Oh, hm. The deserialisation hits on every single request. I haven't measured it, but I guess the impact is there as the payload is parsed in PHP. Therefore I would love to have arguments why it is viable to accept this impact and that it factually increases security. Thanks
  7. Helmut Hummel commented on patch set 13 03/30/26, 08:10

    PackageCacheEntry.php:117 Reply

    OK, sorry for spamming here. I have another point to make: PackageArtifact.php *IS* already a PHP file. So why would an attacker bother with finding a class that can be exploited with an insecure unserlialize, when they can simply inject PHP code before the return statement?
  8. Mathias Brodala commented on patch set 13 03/30/26, 08:12

    PackageCacheEntry.php:117 Reply

    E.g. obfuscation. This way an attack vector is harder to detect.
  9. Simon Schaufelberger commented on patch set 13 03/30/26, 09:26

    Deprecation-109409-Access-of-arbitrary-resources-in-extentsions.rst:5

    not the same length as the title
  10. Simon Praetorius commented on patch set 13 03/30/26, 10:06

    Feature-109409-Allow-configuration-of-public-resources.rst:141

    Just to confirm: This means that we cannot introduce additional default paths in the future that will also apply to extensions who have this file, right?

    Feature-109409-Allow-configuration-of-public-resources.rst:191

    If I remove `_assets`, what exactly does that mean? Will it still be created for published extension assets, but it cannot be used directly to reference assets?
  11. Oliver Hader commented on patch set 13 03/30/26, 15:46

    PackageCacheEntry.php:117 Reply

    I tried to implement it using `PolymorphicDeserializer` and fixed some performance issues on the way, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/93432 Besides that, using `PolymorphicDeserializer` was "only" around 5% slower on my local environment in the TYPO3 backend (`400 ms` using the "open" unserialize, `420 ms` using `PolymorphicDeserializer`). ```patch - unserialize($packageData['packageObjects']), + $deserializer->deserialize($packageData['packageObjects'], [ + \stdClass::class, + Package::class, + MetaData::class, + PackageConstraint::class, + ResourceCollectionInterface::class, + ResourceDefinitionInterface::class, + DynamicPublicPrefixInterface::class, + ]), ``` So, even it currently cannot be exploited directly, I'd personally have a better feeling when using an `unserialize` call that is more restricted. In case it still is not wanted, at least I'd be happy about having a comment there that explains why it's not considered a vulnerability (basically for security researchers to read, before they send us their reports).
  12. Helmut Hummel uploaded patch set 14 V +1 03/30/26, 19:33

  13. core-ci voted on patch set 14 V -1 03/30/26, 19:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99109

  14. Helmut Hummel uploaded patch set 15 V -1 03/30/26, 20:07

  15. Benni Mack commented on patch set 15 03/30/26, 20:34

    Feature-109409-Allow-configuration-of-public-resources.rst:186

    uploads is not supported anymore since 10.4, we can skip this.
  16. core-ci voted on patch set 15 V -1 03/30/26, 20:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99116

  17. Helmut Hummel uploaded patch set 16 V -1 03/30/26, 20:48

  18. Helmut Hummel commented on patch set 16 03/30/26, 20:54

    PackageCacheEntry.php:117 Reply

    Done

    DefaultPublicPrefix.php:30 Reply

    Done

    Deprecation-109409-Access-of-arbitrary-resources-in-extentsions.rst:5 Reply

    Acknowledged

    Feature-109409-Allow-configuration-of-public-resources.rst:67 Reply

    Done

    Feature-109409-Allow-configuration-of-public-resources.rst:90 Reply

    done

    Feature-109409-Allow-configuration-of-public-resources.rst:104 Reply

    Done

    Feature-109409-Allow-configuration-of-public-resources.rst:141 Reply

    Done

    Feature-109409-Allow-configuration-of-public-resources.rst:153 Reply

    Done

    Feature-109409-Allow-configuration-of-public-resources.rst:186 Reply

    that is currently tightly integrated and tested. removing that, could make sense in a different change. this could be considered breaking, but if uploads really is gone, we should be fine removing this.

    Feature-109409-Allow-configuration-of-public-resources.rst:191 Reply

    Done

    Feature-109409-Allow-configuration-of-public-resources.rst:207 Reply

    Done

    Feature-109409-Allow-configuration-of-public-resources.rst:210 Reply

    Done
  19. Helmut Hummel uploaded patch set 17 03/30/26, 20:56

  20. core-ci voted on patch set 16 V +1 03/30/26, 21:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99118

  21. core-ci voted on patch set 17 V +1 03/30/26, 21:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99119

  22. Garvin Hicking voted on patch set 17 CR +1 V +1 03/31/26, 05:03

  23. Benni Mack voted on patch set 17 CR +2 V +2 03/31/26, 05:22

  24. Benni Mack merged patch set 18 03/31/26, 05:22

  25. Stefan Bürk commented on patch set 18 CR +1 V +1 03/31/26, 05:51

    Post +1 was not quick enough with reviewing ... shoudl have done this in the night already ;)