95569[BUGFIX] Allow CSP directive "strict-dynamic" in conjunction w/ hashes
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 3
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/69/95569/3 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/69/95569/3 && git cherry-pick FETCH_HEAD
Review
-
Code review CR -1 Needs a vote
- Garvin Hicking -1
- Josua Vogel +1
- Benni Mack +1
-
Verified V +1 Needs a vote
- Benni Mack +1
- core-ci +1 CI
Merge conflicts 2
Issues 1
Files 2
Review log 1013
-
Garvin Hicking uploaded patch set 1 09/02/26, 15:33
-
core-ci voted on patch set 1 V +1 09/02/26, 15:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107647
-
Garvin Hicking updated the commit message in patch set 2
V +109/03/26, 11:12 -
core-ci voted on patch set 2 V +1 09/03/26, 11:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107744
-
Benni Mack voted on patch set 2 CR +1 V +1 09/04/26, 13:13
-
Garvin Hicking rebased onto patch set 3
CR +1V +110/01/26, 07:55 -
Benni Mack voted on patch set 3 CR +1 V +1 10/01/26, 07:55
-
core-ci voted on patch set 3 V +1 10/01/26, 08:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109761
-
Josua Vogel voted on patch set 3 CR +1 10/01/26, 10:18
-
Benjamin Franzke commented on patch set 3 10/01/26, 10:41
Policy.php:247Hm, `applySourceImplications()` actually contains logic for `strictDynamic` in the `SourceKeyword` enum, where it ensures that the nonce proxy is added to the sources. See https://github.com/TYPO3/typo3/blob/bbaf7003b636be0a48aa447afe080908208facd1/typo3/sysext/core/Classes/Security/ContentSecurityPolicy/SourceKeyword.php#L64-L66 I wonder if that part should be adapted within that method (instead of avoiding to call that method). E.g. instead of unconditionally adding the nonce proxy in there, it could be changed to check for the hash value type in there instead of below.Policy.php:250I wonder where the `nonceProxy` actually comes from, that is about to be removed here? From my understanding it would have been added by `applySourceImplications` (previously), when *needed* for strict dynamic. If it was added by other parts of the system (that really need the nonce), we should not "just" remove it here, because there is some hash value defined. Reason: There needs to be a reason why nonce proxy is added, which is: it seems to be *used*. What I mean: We can not assume that a policy contains nonces and hashes, can just remove the hashes, because there can be components that do not use hashes and actually activated nonce usage. TL;DR (of all 3 comments): Would any of your tests fail if the `elseif ($collection->containsTypes(HashValue::class)) {` branch did nothing (that means it does not remove the nonce proxy)? -
Benjamin Franzke commented on patch set 3 10/01/26, 10:51
Policy.php:247Reply UnresolvedOr maybe better: Remove `applySourceImplications` alltogether. It seems it would be better to handle all logic in one place. What do you think? -
Garvin Hicking commented on patch set 3 CR -1 10/01/26, 10:51
Policy.php:250Reply UnresolvedYou're right, tests currently don't fail when disabling this branch, so we have missing coverage here. I'll go back to the drawing board here. Thanks! -
Benni Mack commented on patch set 3 10/01/26, 11:00
Policy.php:246Reply UnresolvedI had it running with: ``` behavior: useNonce: false useHash: true ``` which we often use in our projects.
Policy.php:246