93419[FEATURE] Prefer CSP hash values over nonce values
Commit message
Review
-
Code review CR +2 Done
- Oliver Hader +2
- Georg Ringer +1
- Benni Mack +1
-
Verified V +2 Done
- Oliver Hader +2
- Georg Ringer +1
- Benni Mack +1
- core-ci +1 CI
Issues 1
Files 33
- typo3/sysext/backend/Classes/Middleware/ContentSecurityPolicyHeaders.php+5 −4
- typo3/sysext/core/Classes/Middleware/AbstractContentSecurityPolicyReporter.php+2 −2
- typo3/sysext/core/Classes/Page/AssetRenderer.php2+43 −1
- typo3/sysext/core/Classes/Page/PageRenderer.php5+98 −17
- typo3/sysext/core/Classes/Page/ResourceHashCollection.php+2 −2
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/Configuration/Behavior.php+34 −1
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/Configuration/CspConfigurationFactory.phprenamed+10 −1
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/Middleware/PolicyBag.php+2 −0
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/DirectiveHashCollection.phpnew+191 −0
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/HashType.php+8 −0
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/HashValue.php+14 −0
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/MutationRepository.php+4 −4
- typo3/sysext/core/Classes/Security/ContentSecurityPolicy/Policy.php+21 −11
- typo3/sysext/core/Documentation/Changelog/14.2/Deprecation-100887-UseNonceArgumentInFAssetViewHelpers.rstnew+75 −0
- typo3/sysext/core/Documentation/Changelog/14.2/Feature-100887-PreferCSPHashValuesOverNonceValues.rst2new+138 −0
- typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php+2 −0
- typo3/sysext/core/Tests/Functional/Security/ContentSecurityPolicy/Reporting/BeforePersistingReportEventTest.php+3 −3
- typo3/sysext/core/Tests/Functional/Security/ContentSecurityPolicy/PolicyTest.php+29 −20
- typo3/sysext/core/Tests/Unit/Page/AssetRendererTest.php+2 −1
- typo3/sysext/core/Tests/Unit/Page/PageRendererFactoryTrait.php+5 −1
Show 13 more files
- typo3/sysext/core/Tests/Unit/Security/ContentSecurityPolicy/Configuration/CspConfigurationFactoryTest.phprenamed+6 −6
- typo3/sysext/fluid/Classes/ViewHelpers/Asset/CssViewHelper.php+24 −2
- typo3/sysext/fluid/Classes/ViewHelpers/Asset/ScriptViewHelper.php+24 −2
- typo3/sysext/fluid/Classes/ViewHelpers/Asset/StyleAttrViewHelper.php2new+53 −0
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/Asset/StyleAttrViewHelperTest.phpnew+70 −0
- typo3/sysext/frontend/Classes/Cache/MetaDataState.php4+27 −8
- typo3/sysext/frontend/Classes/Middleware/ContentSecurityPolicyHeaders.php+10 −10
- typo3/sysext/frontend/Classes/Middleware/ContentSecurityPolicyReporter.php+1 −1
- typo3/sysext/frontend/Tests/Functional/SiteHandling/RequestHandlerTest.php+1 −1
- typo3/sysext/install/Classes/Controller/InstallerController.php+7 −1
- typo3/sysext/install/Classes/Controller/LayoutController.php+7 −1
- typo3/sysext/install/Classes/ServiceProvider.php+16 −0
- typo3/sysext/lowlevel/Classes/ConfigurationModuleProvider/ContentSecurityPolicyMutationsProvider.php+6 −2
Review log 2533
Show 58 earlier messages
-
Oliver Hader uploaded patch set 1 03/28/26, 15:19
-
Oliver Hader uploaded patch set 2 03/28/26, 15:21
-
core-ci voted on patch set 2 V -1 03/28/26, 15:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98960
-
core-ci commented on patch set 2 03/28/26, 15:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98960
-
Oliver Hader uploaded patch set 3
V -103/28/26, 16:00 -
Oliver Hader wrote 03/28/26, 16:01
Topic set to csp -
core-ci voted on patch set 3 V -1 03/28/26, 16:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98961
-
Oliver Hader uploaded patch set 4
V -103/28/26, 16:14
-
Oliver Hader commented on patch set 4 03/28/26, 16:18
This change is ready for review. -
core-ci voted on patch set 4 V +1 03/28/26, 16:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98964
-
Georg Ringer commented on patch set 4 CR +1 V +1 03/28/26, 16:39
Feature-100887-PreferCSPHashValuesOverNonceValues.rst:117IMO either {true} oder 1 -
Oliver Hader uploaded patch set 5
CR +1V +103/28/26, 17:06 -
Oliver Hader commented on patch set 5 03/28/26, 17:07
Feature-100887-PreferCSPHashValuesOverNonceValues.rst:117ReplyThx. I adjusted it... -
Oliver Hader commented on patch set 5 03/28/26, 17:09
Side-note: To enforce hashes and avoid nonces the following should be in the `csp.yaml` of a particular site: ```yaml behavior: useNonce: false useHash: true ``` Automatic inference might come later - currently it's only via explicit opt-in. -
Oliver Hader commented on patch set 5 03/28/26, 17:10
Reply
(reopening) -
core-ci voted on patch set 5 V +1 03/28/26, 17:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98965
-
Garvin Hicking commented on patch set 5 03/28/26, 17:37
AssetRenderer.php:69This would not trigger for a useNonce: 0 or useNonce: false setting due to empty(), probably unwanted? (Same for following triggers; fine for the actual content checks ofc)PageRenderer.php:841Rename $useNonce too maybe?PageRenderer.php:1624(See note on empty above)StyleAttrViewHelper.php:53Multiple values "color: green; border: 500px solid red" are fine? The description might imply only a single value is allowed.MetaDataState.php:80I think we have a JSON Utility class that reduces this boilerplate code (can't look it up on mobile atm) -
Georg Ringer commented on patch set 5 CR +1 V +1 03/28/26, 19:19
as followup, adminpanel and probbaly others should be changed to use hashes (See \TYPO3\CMS\Adminpanel\Utility\ResourceUtility::getResources) -
Oliver Hader uploaded patch set 6
CR +1V +103/28/26, 20:47 -
Oliver Hader commented on patch set 5 03/28/26, 20:47
AssetRenderer.php:69Reply`isset` should be fine here... I mixed that with the Fluid view-helper attribute.PageRenderer.php:841ReplyI kept it for people that (maybe) used names parameters. However, I'm totally fine with adjusting that as well.PageRenderer.php:1624ReplyDoneStyleAttrViewHelper.php:53ReplyThe value could be anything, it is not parsed into CSS - but the hash is calculate on the whole value. I'll adjust the comments here. Besides that, it seems I started to refactor the behavior from an old patch, but did not finish...MetaDataState.php:80ReplyI failed to find any other existing code... -
Oliver Hader commented on patch set 6 03/28/26, 20:48
Reply
Thanks for the hint. I had that in an older/outdated version as well (see https://review.typo3.org/c/Packages/TYPO3.CMS/+/80554) -
Oliver Hader uploaded patch set 7 03/28/26, 20:54
-
Oliver Hader commented on patch set 6 03/28/26, 20:55
MetaDataState.php:80ReplyAt least I reduced the code in this very class a bit... -
core-ci voted on patch set 6 V +1 03/28/26, 20:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98970
-
core-ci voted on patch set 7 V +1 03/28/26, 21:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/98971
-
Garvin Hicking commented on patch set 7 CR +1 03/28/26, 21:38
PageRenderer.php:841ReplyOh, I understand now. That might actually be. I mean we have a policy on that, but now I'm torn. $csp would be clearer... so maybe we can use this as "testing the waters" how many people use named parameters and complain? ;-)MetaDataState.php:80ReplyHaha my bad. I mixed this up with my company's JSON Utility helper that I use all the time 🤪 Thanks for iterating here! -
Georg Ringer voted on patch set 7 CR +1 V +1 03/29/26, 09:14
-
Oliver Hader uploaded patch set 8
CR +1V +103/30/26, 06:44 -
core-ci voted on patch set 8 V +1 03/30/26, 06:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99006
-
Georg Ringer voted on patch set 8 CR +1 V +1 03/30/26, 07:32
-
Benni Mack voted on patch set 8 CR +1 V +1 03/30/26, 16:30
-
Oliver Hader commented on patch set 8 CR +2 V +2 03/30/26, 16:32
Reply
Done -
Oliver Hader merged patch set 9 03/30/26, 16:32