Review main Merged

87670[BUGFIX] Allow site-specific Content-Security-Policy endpoints

Oliver Hader CR +2 V +2 Hard +232 −24 updated 02/13/25, 07:12

Commit message

This change allows to disable the local Content-Security-Policy
reporting endpoint by setting the global scope-specific setting
`contentSecurityPolicyReportingUrl` to zero ('0'):

* [TYPO3_CONF_VARS][FE][contentSecurityPolicyReportingUrl] = '0'
* [TYPO3_CONF_VARS][BE][contentSecurityPolicyReportingUrl] = '0'

The reporting URL now can be defined per site via csp.yaml like this:

enforce:
  inheritDefault: true
  mutations: {}
  # for disabling the reporting endpoint for a particular site
  reportingUrl: false
  # for using a different external reporting endpoint
  reportingUrl: https://reporting.example.org/
  # for using the default local reporting endpoint (default)
  reportingUrl: true

Site-specific `reportingUrl` take precedence over global settings.
In case the explicitly disabled endpoint still would be called, the
server-side process responds with a 403 HTTP error message.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Garvin Hicking +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Garvin Hicking +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 12

Review log 1621

  1. Oliver Hader uploaded patch set 1 01/08/25, 14:59

  2. Oliver Hader marked it work in progress 01/08/25, 14:59

  3. core-ci voted on patch set 1 V -1 01/08/25, 15:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72098

  4. Oliver Hader uploaded patch set 2 V -1 01/08/25, 18:08

  5. core-ci voted on patch set 2 V +1 01/08/25, 18:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72110

  6. Oliver Hader uploaded patch set 3 V +1 01/22/25, 15:56

  7. Oliver Hader commented on patch set 3 01/22/25, 15:57

    This change is ready for review.
  8. core-ci voted on patch set 3 V +1 01/22/25, 16:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72870

  9. Garvin Hicking wrote 01/22/25, 16:08

    Topic set to csp
  10. Oliver Hader uploaded patch set 4 V +1 01/22/25, 19:24

  11. core-ci voted on patch set 4 V +1 01/22/25, 19:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72882

  12. Garvin Hicking commented on patch set 4 CR +1 V +1 01/24/25, 19:00

    Took a bit longer to review thoroughly because of all the possible mutations (haha) of configuring the CSP. This all seems to work well, thanks for this effort! One minor question: If one sets `reportingUrl: 0` or `reportingingUrl: 1` (because people may not recognize `'0'` versus `0` or are used to TypoScript true/false notations) then currently a PHP type error is thrown: ``` TYPO3\CMS\Core\Security\ContentSecurityPolicy\Configuration\DispositionConfiguration::__construct(): Argument #3 ($reportingUrl) must be of type string|bool|null, int given, called in /var/www/html/typo3-core/typo3/sysext/core/Classes/Security/ContentSecurityPolicy/Configuration/DispositionMapFactory.php on line 109 ``` I wonder if we should additionall allow "|int" here, but cast it to a string..? For '0' this would result in the wanted behavior, for '1' this would lead to a reporting-url of '/1'. The latter would hint people at probably doing stuff wrong, and at least it wouldn't break the frontend rendering. What do you think?
  13. Benni Mack commented on patch set 4 01/24/25, 19:45

    Reply

    i agree
  14. Oliver Hader uploaded patch set 5 CR +1 V +1 02/03/25, 13:39

  15. Oliver Hader commented on patch set 5 02/03/25, 13:41

    Reply

    Good point, thanks! I've adjusted it in the code 👍
  16. core-ci voted on patch set 5 V +1 02/03/25, 13:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73407

  17. Garvin Hicking commented on patch set 5 CR +1 V +1 02/03/25, 14:30

    Seems to do the trick, and thanks for going the extra mile here
  18. Benni Mack voted on patch set 5 CR +1 V +1 02/05/25, 10:21

  19. Oliver Hader voted on patch set 5 CR +2 V +2 02/05/25, 13:21

  20. Oliver Hader merged patch set 6 02/05/25, 13:23

  21. Lina Wolf commented on patch set 6 02/13/25, 07:12