Review main Merged

91160[BUGFIX] Ensure CSP header has nonce in partially cached state

Oliver Hader CR +2 V +2 Normal +112 −14 updated 10/23/25, 11:24

Commit message

Issue #107613 revealed that the frontend rendering stack created
two distinct `ConsumableNonce` instances – one in the global request
(used for building the Content‑Security‑Policy header) and another
one inside `PageRenderer::updateState()` (used for counting nonces
when adding assets).

When assets were rendered via an uncached cObject (e.g. `COA_INT`,
`USER_INT`) the nonce consumption counter was not incremented. As
a result the generated CSP header did not contain a nonce source and
browsers rejected inline scripts/styles.

Review

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

Issues 1

Files 3

Review log 1013

  1. Oliver Hader uploaded patch set 1 10/19/25, 09:08

  2. Oliver Hader uploaded patch set 2 10/19/25, 09:12

  3. core-ci voted on patch set 1 V -1 10/19/25, 09:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87008

  4. core-ci voted on patch set 2 V +1 10/19/25, 09:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87009

  5. Christian Kuhn commented on patch set 2 10/19/25, 10:15

    RequestHandler.php:156

    note the key is used as content string identifier "INT_SCRIPT.theArrayKey" to be searched an replaced in content. see tsfe processNonCacheableContentPartsAndSubstituteContentMarkers(). i'm fiddling with this in https://review.typo3.org/c/Packages/TYPO3.CMS/+/91156, taking away the meaning of the key and adding a dedicated 'substKey' key-value instead. i'd prefer if the patch could keep [] = [...] and not [onceValueSubstitution::class] = [...] here for now to not suggest additional meaning that is not used and relevant here. With https://review.typo3.org/c/Packages/TYPO3.CMS/+/91156 i'm setting 'substKey' = null here (and i will probably rename 'substKey' to maybe 'contentMarker' or similar to make it more clear) and i added a temporary todo to recheck this before the patch finalizes.
  6. Oliver Hader commented on patch set 2 10/19/25, 16:35

    RequestHandler.php:156 Reply

    TSFE splits by `<!--INT_SCRIPT...-->` and uses these keys to search for the counterpart in `INTincScript` array. I'm fine with omitting the `NonceValueSubstitution::class` key here.
  7. Oliver Hader uploaded patch set 3 V +1 10/19/25, 17:08

  8. core-ci voted on patch set 3 V +1 10/19/25, 17:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87018

  9. Oliver Hader commented on patch set 3 10/19/25, 17:17

    This change is ready for review.
  10. Benni Mack voted on patch set 3 CR +1 V +1 10/20/25, 09:26

  11. Sven Liebert voted on patch set 3 CR +1 V +1 10/20/25, 10:00

  12. Oliver Hader voted on patch set 3 CR +2 V +2 10/23/25, 11:24

  13. Oliver Hader merged patch set 4 10/23/25, 11:24