Review main Abandoned

86983[BUGFIX] Respect TypoScript option "external" for external hosted resources

Josef Glatz CR 0 V -1 Easy +32 −0 updated 10/30/25, 07:37

Commit message

This patch adds the missing check for external CSS and external JS
resources. External JS/CSS resources must be included only if an
integrator set option `.external = 1`.

An resource is external if the url starts with "https", "http" or "//".

It looks like the used file path sanitizer does not fail while checking
the resource. External resources are actually allowed.

This patch re-adds the check and only includes the external resource if
the external option is explicitly enabled by the TYPO3 integrator.

A valid example looks like:

  page.includeCSS {
    1 = https://example.com/another.css
    1.external = 1
  }

Review

  • Code review CR 0
  • Verified V -1
    • Josef Glatz -1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1723

  1. Josef Glatz uploaded patch set 1 11/13/24, 15:11

  2. Josef Glatz updated the commit message in patch set 2 11/13/24, 15:17

  3. Josef Glatz commented on patch set 2 11/13/24, 15:18

    This change is ready for review.
  4. core-ci voted on patch set 1 V +1 11/13/24, 15:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69406

  5. Josef Glatz commented on patch set 2 11/13/24, 15:22

    It look likes https://github.com/typo3/typo3/blob/7c478e10a2fc289235db6d04a1e9fc8212c7e15a/typo3/sysext/frontend/Classes/Resource/FilePathSanitizer.php#L77 can handle such external resources and does not throw any exception. I've added @benni@typo3.org since he refactored a lot in this place a couple of years ago
  6. core-ci voted on patch set 2 V +1 11/13/24, 15:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69407

  7. Josef Glatz commented on patch set 2 11/13/24, 15:25

    # You can test it just by temporary adding TypoScript ``` includeCSS { 1 = https://unpkg.com/open-props 2 = https://unpkg.com/open-props/normalize.min.css 1.external = 1 2.external = 0 } ``` in the file typo3/sysext/styleguide/Configuration/Sets/Styleguide/setup.typoscript within the PAGE block for easy reproducing/testing
  8. Josef Glatz commented on patch set 2 11/14/24, 06:45

    Because there were already some private questions, here's the specific part of the documentation which is the primary cause of this patch: > The file definition must be a valid resource data type, otherwise nothing is inserted. This means that remote files cannot be referenced (i.e. using https://...), except by using the .external property.
  9. Josef Glatz updated the commit message in patch set 3 V +1 11/14/24, 06:52

  10. core-ci voted on patch set 3 V +1 11/14/24, 06:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69422

  11. Josef Glatz commented on patch set 3 11/14/24, 09:22

    regression is caused by https://review.typo3.org/c/Packages/TYPO3.CMS/+/27130. ~10 years ago. If we keep it without patching: we have to update - docs - certified integrator question - skilldisplay (flo) If we add the check again: - only some missing infos in the docs are necessary
  12. Fabien Udriot voted on patch set 3 CR +1 11/14/24, 10:54

  13. Josef Glatz rebased onto patch set 4 CR +1 V +1 01/21/25, 12:28

  14. Benni Mack voted on patch set 4 CR +1 01/21/25, 12:28

  15. core-ci voted on patch set 4 V +1 01/21/25, 12:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72781

  16. Česlav Przywara commented on patch set 4 01/23/25, 09:47

    RequestHandler.php:972 Unresolved

    @typo3@josefglatz.at Just nitpicking, but "ressource" should be replaced with resource (one s only - there is no such word as ressource in English). Also in method docblock. ```suggestion public function resourceIsExternal(string $resource): bool ```
  17. Georg Ringer commented on patch set 5 CR +1 V +1 03/13/25, 20:07

    Published edit on patch set 4.
  18. Georg Ringer commented on patch set 6 03/13/25, 20:07

    Published edit on patch set 5.
  19. core-ci voted on patch set 5 V +1 03/13/25, 20:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75561

  20. core-ci voted on patch set 6 V +1 03/13/25, 20:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75562

  21. Benni Mack commented on patch set 6 08/15/25, 14:40

    I think a lot of time has passed, I wonder if we should really re-add this?
  22. Josef Glatz commented on patch set 6 V -1 10/30/25, 07:37

    @benni@typo3.org There is a followup which should be used instead from my pov https://review.typo3.org/c/Packages/TYPO3.CMS/+/91350
  23. Josef Glatz abandoned the change 10/30/25, 07:37