Review main Merged

84435[BUGFIX] Do not render nonceProxy if nonce has not been consumed

Benjamin Franzke CR +2 V +2 Easy +15 −5 updated 05/31/24, 08:05

Commit message

Allow proxies to cache the TYPO3 content by stripping the nonce from
the generated CSP header if the nonce was not actually consumed.

Also ensure that the nonce value substitution consumes a nonce
to ensure that a (replaced) nonces in cached-content receive
a matching CSP header as well.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Kai Ole Hartwig +1
    • Oliver Hader +1
    • Willi Wehmeier +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Oliver Hader +1
    • Willi Wehmeier +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 2533

Show 68 earlier messages
  1. Benjamin Franzke uploaded patch set 1 05/28/24, 09:14

  2. core-ci voted on patch set 1 V +1 05/28/24, 09:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58387

  3. Patrick Schriner commented on patch set 1 05/28/24, 10:44

    nonce-proxy can be in many directives (e.g. styleSrcElem (https://github.com/TYPO3/typo3/blob/c3b44914163402baf77a896e5a6fa51f369daad2/typo3/sysext/core/Classes/Security/ContentSecurityPolicy/Processing/GoogleMapsHandler.php#L124) While this would be ok for the default CSPs from EXT:frontend, it's not a good generic solution?
  4. Benjamin Franzke commented on patch set 1 CR -1 05/28/24, 12:06

    Reply

    Acknowledged, will try to find a better solution
  5. Benjamin Franzke uploaded patch set 2 CR -1 V +1 05/28/24, 13:20

  6. Benjamin Franzke commented on patch set 2 05/28/24, 13:20

    Reply

    Done
  7. core-ci voted on patch set 2 V -1 05/28/24, 13:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58400

  8. Benjamin Franzke uploaded patch set 3 V -1 05/28/24, 13:35

  1. core-ci voted on patch set 3 V -1 05/28/24, 13:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58403

  2. core-ci voted on patch set 3 V +1 05/28/24, 13:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58403

  3. Oliver Hader commented on patch set 3 05/29/24, 08:52

    In general we should try to avoid using nonces at all in TYPO3 frontend for those caching reasons - however, there's no better alternative available at this time for TYPO3 (just a PoC, see #100887).
  4. Oliver Hader commented on patch set 3 CR +1 05/29/24, 08:54

    Assuming that also e.g. `window.litNonce` in the frontend (it's not a common thing at all) would "consume" the nonce value...
  5. Benjamin Franzke commented on patch set 3 05/29/24, 08:56

    Reply

    ack, and this patch is for the case where no nonce is used (e.g. no external script is rendered) and will help to migrate to hash-based CSP's.
  6. Kai Ole Hartwig voted on patch set 3 CR +1 V +1 05/29/24, 14:02

  7. Willi Wehmeier voted on patch set 3 CR +1 V +1 05/29/24, 14:04

  8. Patrick Schriner commented on patch set 3 CR +1 V +1 05/29/24, 14:22

    This saves the effort of having to remove nonce-proxy from the ContentSecurityPolicies.php definition if not needed - nice
  9. Benjamin Franzke voted on patch set 3 CR +2 V +2 05/30/24, 07:17

  10. Benjamin Franzke wrote 05/30/24, 07:19

    Topic set to csp
  11. Benjamin Franzke commented on patch set 3 CR -1 05/30/24, 07:37

    blocking for a bit in case olly wants to test
  12. Oliver Hader commented on patch set 3 V -1 05/30/24, 08:59

    On it..
  13. Oliver Hader uploaded patch set 4 CR +1 V +1 05/30/24, 09:07

  14. core-ci voted on patch set 4 V +1 05/30/24, 09:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58477

  15. Benjamin Franzke uploaded patch set 5 V +1 05/30/24, 09:16

  16. core-ci voted on patch set 5 V -1 05/30/24, 09:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58478

  17. core-ci voted on patch set 5 V +1 05/30/24, 09:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58478

  18. Oliver Hader voted on patch set 5 CR +1 V +1 05/30/24, 09:43

  19. Benjamin Franzke uploaded patch set 6 CR +1 V +1 05/30/24, 10:17

  20. core-ci voted on patch set 6 V +1 05/30/24, 10:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58481

  21. Oliver Hader voted on patch set 6 CR +1 V +1 05/30/24, 12:02

  22. Kai Ole Hartwig voted on patch set 6 CR +1 05/30/24, 14:47

  23. Willi Wehmeier voted on patch set 6 CR +1 V +1 05/31/24, 05:47

  24. Benjamin Franzke voted on patch set 6 CR +2 V +2 05/31/24, 08:04

  25. Benjamin Franzke merged patch set 7 05/31/24, 08:05