Review main Merged

80185[BUGFIX] Allow strict-dynamic only for applicable CSP directives

Oliver Hader CR +2 V +2 Normal +44 −17 updated 07/28/23, 19:56

Commit message

Using 'strict-dynamic' (SourceKeyword::strictDynamic) should only
be allowed for script-src*[1] directives. Using it for any other
directive produces strange side effects, since it implicitly adds
a CSP nonce value to that directive when compiling the policy.

Thus, this change
+ ensures 'strict-dynamic' is applicable for script-src* when
  using Policy::set, Policy::extend or the constructor
+ removes invalid policy purges when 'strict-dynamic' was used,
  since that was only valid for CSP level 3 - ignoring these
  directives is supposed to be handled by the browser[2], not by
  the server-side API, in order to preserve CSP v1/v2 BC.

[1] https://w3c.github.io/webappsec-csp/#allow-all-inline
> 'strict-dynamic' only applies to scripts, not other resource types.

[2] https://w3c.github.io/webappsec-csp/#strict-dynamic-usage
> 8.2. Usage of "'strict-dynamic'"
> If present in a script-src or default-src directive, it has two
> main effects:
> * host-source and scheme-source expressions, as well as the
>   "'unsafe-inline'" and "'self' keyword-sources will be ignored
>   when loading script.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1320

  1. Oliver Hader uploaded patch set 1 07/27/23, 11:01

  2. core-ci voted on patch set 1 V +1 07/27/23, 11:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44609

  3. Oliver Hader uploaded patch set 2 V +1 07/27/23, 11:09

  4. core-ci voted on patch set 2 V +1 07/27/23, 11:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44611

  5. Oliver Hader voted on patch set 2 CR -1 07/27/23, 12:40

  6. Oliver Hader uploaded patch set 3 CR -1 V +1 07/27/23, 12:54

  7. Oliver Hader uploaded patch set 4 07/27/23, 12:55

  8. core-ci voted on patch set 4 V +1 07/27/23, 13:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44617

  9. core-ci voted on patch set 3 V -1 07/27/23, 13:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44616

  10. Oliver Hader rebased onto patch set 5 V +1 07/28/23, 09:22

  11. core-ci voted on patch set 5 V +1 07/28/23, 09:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44661

  12. Benjamin Franzke uploaded patch set 6 V +1 07/28/23, 11:44

  13. core-ci voted on patch set 6 V +1 07/28/23, 11:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44667

  14. Oliver Hader updated the commit message in patch set 7 CR +1 V +1 07/28/23, 18:15

  15. core-ci voted on patch set 7 V +1 07/28/23, 18:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44687

  16. Benjamin Franzke voted on patch set 7 V +1 CR +1 07/28/23, 18:38

  17. Christian Kuhn voted on patch set 7 V +1 CR +1 07/28/23, 19:43

  18. Stefan Bürk voted on patch set 7 V +1 CR +1 07/28/23, 19:44

  19. Benjamin Franzke voted on patch set 7 V +2 CR +2 07/28/23, 19:56

  20. Benjamin Franzke merged patch set 8 07/28/23, 19:56