Review main Merged

90915[TASK] Refine CSP Directive and SourceKeyword cases

Oliver Hader CR +2 V +2 Normal +144 −9 updated 10/09/25, 18:24

Commit message

* added Directive::getFamily() method
  - Directive::ScriptSrc->getFamily() now includes
    ScriptScr, ScriptSrcAttr, ScriptSrcElem
  - Directive::StyleSrc->getFamily() now includes
    StyleSrc, StyleSrcAttr, StyleSrcElem
* added additional SourceKeyword restrictions
  - unsafeHashes allowed in DefaultSrc & ScriptSrc/StyleSrc families
  - unsafeInline allowed in DefaultSrc & ScriptSrc/StyleSrc families
  - nonceProxy allowed in DefaultSrc & ScriptSrc/StyleSrc families,
    except their Attr aspects
* added SourceKeyword::getApplicableDirectives for resolving the
  Directive restrictions mentioned in the previous section

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 3

Review log 1620

  1. Oliver Hader uploaded patch set 1 10/06/25, 16:43

  2. core-ci voted on patch set 1 V +1 10/06/25, 16:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86088

  3. Garvin Hicking commented on patch set 1 10/06/25, 17:09

    Since this would be public API (right?) and doesn't have a ReST file, could you add some more info to this so that we can add it to docs? Or would you maybe create a Docs PR when it gets merged?
  4. Oliver Hader commented on patch set 1 10/06/25, 18:58

    Reply

    You're just referring to `Directive::getFamily()`, correct? If it's too confusing, I'm fine with dropping that change and just use it inline all the time when needed.
  5. Garvin Hicking commented on patch set 1 10/06/25, 20:11

    Reply

    Yes - I thought since it is public it would/should be usable by third parties, but then it would need some explanation. If you're using it as a helper, maybe declare that single method as `@internal`? I do see it can't be made protected there. (I'm just commenting from a "public API documentation devil's advocate" point of view here)
  6. Oliver Hader marked it work in progress 10/07/25, 07:16

  7. Oliver Hader uploaded patch set 2 V +1 10/07/25, 11:38

  8. Oliver Hader marked it ready for review 10/07/25, 11:38

  9. Oliver Hader commented on patch set 2 10/07/25, 11:42

    Reply

    I just marked the new public methods as `@internal` - those are supposed to be used by other core classes and the code fits best with these two classes (`Directive` and `SourceKeyword`) - instead of cluttering other classes with private constants basically doing all the same. I'm not sure (yet) whether those methods would be useful in custom code and whether it's required or helpful to add documentation RST files for each of these PHP methods.
  10. core-ci voted on patch set 2 V +1 10/07/25, 11:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86150

  11. Garvin Hicking commented on patch set 2 10/07/25, 12:12

    Reply

    Thanks, I consider that explained and solved like this. (Could not review/test/understand this, so I can't vote on this atm, not because I disagree)
  12. Oliver Hader rebased onto patch set 3 V +1 10/07/25, 19:16

  13. core-ci voted on patch set 3 V +1 10/07/25, 19:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86179

  14. Oliver Hader commented on patch set 3 10/07/25, 19:45

    Reply

    Thanks for your feedback & that's totally fine. I admin, the scope of these changes cannot be determined without having the actual use cases. I reworked https://review.typo3.org/c/Packages/TYPO3.CMS/+/90814/7, which is part of the relation chain.
  15. Oliver Hader rebased onto patch set 4 V +1 10/08/25, 13:53

  16. core-ci voted on patch set 4 V +1 10/08/25, 14:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86234

  17. Benni Mack voted on patch set 4 CR +1 V +1 10/09/25, 13:53

  18. Garvin Hicking voted on patch set 4 CR +1 V +1 10/09/25, 15:35

  19. Oliver Hader voted on patch set 4 CR +2 V +2 10/09/25, 18:24

  20. Oliver Hader merged patch set 5 10/09/25, 18:24