Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Orphaned

80554[TASK] Prefer CSP hash values over nonce values

Oliver Hader CR 0 V 0 Expert +1543 −290 updated 03/28/26, 20:49

Commit message

@todo
+ add more tests
+ documentation
+ refine semantics in view-helpers
  `<f:asset.css integrity="..." nonce="..." useNonce="1" csp="1">`
  + integrity shall be used over resolving the data (HashCollector)
  + nonce shall be used, but without adding it to CSP
  + useNonce shall be dropped long-term
  + csp shall be used to tell the system "take care of CSP adjustments"
+ TypoScript page.includeCSS does not support SRI

Changes in external packages:
+ https://github.com/benjaminkott/bootstrap_package/pull/1438 compat
+ https://github.com/lochmueller/staticfilecache/pull/401 adjustments

CSP nonce values need to be regenerated for each dynamic request.
This is handled automatically for the regular frontend rendering
process, but introduces new challenges for cache proxies or data
that shall be cached statically (e.g. ext:staticfilecache).

This change introduces a new "integrity strategy" and allows to
prefer static hash values over dynamic nonce values.

The backend UI still needs to enforce using `'unsafe-inline'` styles,
since there are still too many actors relying on `style-src-attr`,
like CKEditor5, @typo3/icons, and various other templates...

The policy behavior can be configured site-specific in the frontend,
the backend user-interface behavior cannot be configured.

behavior:
  useNonce: drop
  useHash: allow
  enforceUnsafeInlineFor:
    - style-src
    - style-src-attr
    - style-str-elem

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 51
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/54/80554/51 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/54/80554/51 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Relation chain 2

  1. main 80664[TASK] Streamline applying stylesheets in lit-element components Based on this change Merged Oliver Hader CR +2 V +2 → 12.4 csp Hard +185 −171

    The chain has patch set 5 of 17, the changes above it need a rebase.

  2. 80554 [TASK] Prefer CSP hash values over nonce values This change

Issues 1

Files 53

Show 33 more files

Review log 60109

Show 4484 earlier messages
  1. Oliver Hader uploaded patch set 1 08/15/23, 09:47

  2. Oliver Hader marked it work in progress 08/15/23, 09:48

  3. core-ci voted on patch set 1 V -1 08/15/23, 09:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45501

  4. Oliver Hader uploaded patch set 2 V -1 08/15/23, 10:02

  5. core-ci voted on patch set 2 V -1 08/15/23, 10:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45502

  6. Oliver Hader uploaded patch set 3 V -1 08/21/23, 14:42

  7. core-ci voted on patch set 3 V -1 08/21/23, 14:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45651

  8. Oliver Hader uploaded patch set 4 V -1 08/22/23, 13:29

  9. Oliver Hader uploaded patch set 5 08/22/23, 13:30

  10. core-ci voted on patch set 4 V -1 08/22/23, 13:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45685

  11. core-ci voted on patch set 5 V -1 08/22/23, 13:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45686

  12. Oliver Hader uploaded patch set 6 V -1 08/22/23, 14:33

  13. core-ci voted on patch set 6 V -1 08/22/23, 14:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45690

  14. Oliver Hader uploaded patch set 7 V -1 08/22/23, 16:10

  15. core-ci voted on patch set 7 V -1 08/22/23, 16:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45692

  16. Oliver Hader uploaded patch set 8 V -1 08/24/23, 06:59

  17. core-ci voted on patch set 8 V -1 08/24/23, 07:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45775

  18. Oliver Hader uploaded patch set 9 08/24/23, 07:33

    Copied Votes: * Verified-1 (copy condition: "changekind:NO_CHANGE")
  19. core-ci voted on patch set 9 V -1 08/24/23, 07:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45776

  20. Oliver Hader wrote 08/30/23, 15:32

    Topic set to csp
  21. Oliver Hader uploaded patch set 10 V -1 10/20/23, 13:33

  22. core-ci voted on patch set 10 V -1 10/20/23, 13:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47976

  23. Oliver Hader uploaded patch set 11 V -1 10/21/23, 13:45

  24. Oliver Hader uploaded patch set 12 10/21/23, 13:52

  25. core-ci voted on patch set 11 V -1 10/21/23, 13:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48008

  26. core-ci voted on patch set 12 V +1 10/21/23, 13:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48009

  27. Oliver Hader uploaded patch set 13 V +1 10/26/23, 10:39

  28. core-ci voted on patch set 13 V +1 10/26/23, 10:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48221

  29. Oliver Hader rebased onto patch set 14 V +1 10/26/23, 15:59

  30. Oliver Hader uploaded patch set 15 10/26/23, 16:27

  31. core-ci voted on patch set 15 V +1 10/26/23, 16:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48254

  32. Oliver Hader uploaded patch set 16 V +1 10/26/23, 20:00

  33. core-ci voted on patch set 16 V +1 10/26/23, 20:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48259

  34. Oliver Hader uploaded patch set 17 V +1 10/26/23, 20:09

  35. core-ci voted on patch set 17 V +1 10/26/23, 20:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48260

  36. Oliver Hader uploaded patch set 18 V +1 10/27/23, 08:20

  37. core-ci voted on patch set 18 V -1 10/27/23, 08:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48277

  38. Oliver Hader uploaded patch set 19 V -1 10/27/23, 08:45

  39. core-ci voted on patch set 19 V +1 10/27/23, 08:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48278

  40. Oliver Hader uploaded patch set 20 V +1 10/31/23, 10:09

  41. Oliver Hader uploaded patch set 21 10/31/23, 10:12

  42. core-ci voted on patch set 20 V -1 10/31/23, 10:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48391

  43. core-ci voted on patch set 21 V -1 10/31/23, 10:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48392

  44. Oliver Hader uploaded patch set 22 V -1 10/31/23, 10:23

  45. core-ci voted on patch set 22 V +1 10/31/23, 10:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48393

  46. Oliver Hader uploaded patch set 23 V +1 11/05/23, 12:59

  47. core-ci voted on patch set 23 V -1 11/05/23, 13:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48590

  48. Oliver Hader uploaded patch set 24 V -1 11/05/23, 13:13

  49. core-ci voted on patch set 24 V -1 11/05/23, 13:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48591

  50. Oliver Hader uploaded patch set 25 V -1 11/05/23, 16:13

  51. core-ci voted on patch set 25 V +1 11/05/23, 16:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48593

  52. Oliver Hader uploaded patch set 26 V +1 11/16/23, 14:23

  53. core-ci voted on patch set 26 V +1 11/16/23, 14:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49031

  54. Oliver Hader uploaded patch set 27 V +1 12/07/23, 12:18

  55. core-ci voted on patch set 27 V +1 12/07/23, 12:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50446

  56. Oliver Hader uploaded patch set 28 V +1 12/07/23, 14:38

  57. core-ci voted on patch set 28 V -1 12/07/23, 14:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50458

  58. Oliver Hader commented on patch set 28 12/07/23, 14:45

    ContentSecurityPolicyHeaders.php:49 Unresolved

    Maybe use prefix, e.g. `csp.nonce`, `csp.scope`?

    AssetRenderer.php:116 Unresolved

    `csp`? `useCsp`, `adjustCsp` (similar for `PageRenderer` as well)?

    PageRenderer.php:1002 Unresolved

    `useNonce` is ugly... `csp`, `useCsp`, `adjustCsp`?
  59. core-ci voted on patch set 28 V +1 12/07/23, 14:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50458

  60. Oliver Hader uploaded patch set 29 V +1 09/17/24, 09:55

    v13-adoptions
  61. core-ci voted on patch set 29 V +1 09/17/24, 10:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65971

  62. Benni Mack updated the commit message in patch set 30 V +1 10/18/24, 13:53

  63. Oliver Hader uploaded patch set 31 10/31/24, 11:51

  64. core-ci voted on patch set 31 V +1 10/31/24, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68915

  65. Oliver Hader uploaded patch set 32 V +1 10/31/24, 12:04

  66. core-ci voted on patch set 32 V -1 10/31/24, 12:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68918

  67. Oliver Hader uploaded patch set 33 V -1 02/28/25, 09:08

  68. core-ci voted on patch set 33 V -1 02/28/25, 09:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74877

  69. Oliver Hader uploaded patch set 34 V -1 02/28/25, 18:30

  70. core-ci voted on patch set 34 V -1 02/28/25, 18:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74918

  71. Oliver Hader uploaded patch set 35 V -1 03/01/25, 07:51

  72. core-ci voted on patch set 35 V -1 03/01/25, 08:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74940

  73. Oliver Hader uploaded patch set 36 V -1 03/04/25, 14:16

  74. core-ci voted on patch set 36 V +1 03/04/25, 14:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75105

  75. Oliver Hader uploaded patch set 37 V +1 03/12/25, 00:18

  76. core-ci voted on patch set 37 V -1 03/12/25, 00:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75488

  77. Oliver Hader uploaded patch set 38 V -1 03/12/25, 09:21

  78. core-ci voted on patch set 38 V -1 03/12/25, 09:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75510

  79. Oliver Hader uploaded patch set 39 V -1 03/12/25, 14:12

  80. Oliver Hader uploaded patch set 40 03/12/25, 14:15

  81. core-ci voted on patch set 39 V -1 03/12/25, 14:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75514

  82. core-ci voted on patch set 40 V -1 03/12/25, 14:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75515

  83. Oliver Hader uploaded patch set 41 V -1 03/12/25, 15:24

  84. core-ci voted on patch set 41 V -1 03/12/25, 15:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75518

  1. Oliver Hader uploaded patch set 42 V -1 03/12/25, 15:32

  2. Oliver Hader uploaded patch set 43 03/12/25, 15:32

  3. core-ci voted on patch set 43 V +1 03/12/25, 15:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75520

  4. Oliver Hader uploaded patch set 44 V +1 03/12/25, 22:34

  5. core-ci voted on patch set 44 V +1 03/12/25, 22:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75528

  6. Oliver Hader uploaded patch set 45 V +1 03/12/25, 22:51

  7. core-ci voted on patch set 45 V +1 03/12/25, 22:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75529

  8. Oliver Hader uploaded patch set 46 V +1 03/13/25, 14:33

  9. core-ci voted on patch set 46 V -1 03/13/25, 14:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75552

  10. Oliver Hader uploaded patch set 47 V -1 03/13/25, 14:48

  11. core-ci voted on patch set 47 V +1 03/13/25, 14:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75553

  12. Oliver Hader uploaded patch set 48 V +1 06/10/25, 15:07

  13. core-ci voted on patch set 48 V -1 06/10/25, 15:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80153

  14. Oliver Hader uploaded patch set 49 V -1 06/10/25, 19:42

  15. core-ci voted on patch set 49 V -1 06/10/25, 19:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80157

  16. Oliver Hader uploaded patch set 50 V -1 06/30/25, 06:29

  17. core-ci voted on patch set 50 V +1 06/30/25, 06:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81134

  18. Oliver Hader commented on patch set 50 08/28/25, 18:47

    NonceValueSubstitution.php:44 Unresolved

    `$currentNonce->consume()` should be just `(string)$currentNonce` then
  19. Garvin Hicking commented on patch set 50 09/03/25, 07:03

    Is maybe https://gitlab.opencode.de/bmi/government-site-builder-11/extensions/gsb-csp helpful to inspect? (didn't check myself)
  20. Oliver Hader uploaded patch set 51 V +1 09/26/25, 13:55

  21. core-ci voted on patch set 51 V +1 09/26/25, 14:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85613

  22. Oliver Hader commented on patch set 51 10/07/25, 22:07

    → alternative approach focussing on avoiding nonces at https://review.typo3.org/c/Packages/TYPO3.CMS/+/90814 Introducing hash-collections is a separate future story then.
  23. Oliver Hader commented on patch set 51 03/28/26, 17:11

  24. Garvin Hicking commented on patch set 51 03/28/26, 17:41

    Reply

    Abandon this one for spring cleaning then?
  25. Oliver Hader commented on patch set 51 03/28/26, 20:49

    Reply Unresolved

    Let's keep this open for the time being. There are several aspects I did not cover in the new approach, yet. Basically just to keep the change "small" - e.g. AdminPanel and Nonce-Hint might be adjusted in follow-up patches.