Review main Merged

81174[TASK] Streamline providing CSP mutations

Oliver Hader CR +2 V +2 Normal +156 −70 updated 10/19/23, 12:33

Commit message

The new MutationRepository is a central place for providing
static mutations (from configuration) and resolved mutations
(static mutations + dynamic resolutions from database). The
corresponding logic has been extracted and moved from the
PolicyProvider to the new repository.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 1719

  1. Oliver Hader uploaded patch set 1 09/22/23, 10:31

  2. Oliver Hader wrote 09/22/23, 10:32

    Topic set to csp
  3. core-ci voted on patch set 1 V +1 09/22/23, 10:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47078

  4. Oliver Hader commented on patch set 1 09/25/23, 12:48

    This change is ready for review.
  5. Benjamin Franzke commented on patch set 1 09/25/23, 13:20

    PolicyProvider.php:56

    Why is `$resolved` `false` and when would we use `true`. (Seems like `$resolved = true` is currently unused) I would have expected `$resolved = true` to be used here, as "resolutions" were done previously via `resolutionRepository->findByScope`?

    Services.yaml:433

    `public: true` can (and thus should) be dropped here
  6. Oliver Hader commented on patch set 1 09/25/23, 13:26

    PolicyProvider.php:56 Reply

    `$resolved = true` is the default when invoking `findByScope()` - however, I'd be fine with making that explicit here.

    Services.yaml:433 Reply

    Ok
  7. Oliver Hader commented on patch set 1 09/25/23, 13:34

    PolicyProvider.php:56 Reply

    The remaining `false` refers to `iterator_to_array(..., $preserve_keys = false)` - since the keys of the `Map` returned by `findByScope` are objects (`MutationOrigin`) - but here for creating the CSP header, only `MutationCollection[]` is relevant.
  8. Andreas Kienast commented on patch set 1 09/26/23, 08:12

    MutationRepository.php:85

    According to PhpStorm: > [EA] Parameter/variable is overridden, but is never used or appears outside of the scope. But since `provideScopeInResolvedMutations()` returns a `Map`, I'm not sure whether this is a false positive. The same goes for the remaining `$target[xx]` assignments.
  9. Oliver Hader commented on patch set 1 09/26/23, 08:52

    MutationRepository.php:85 Reply

    It's a false positive. The EA plugin is not capable of resolving this - even with a standard `\ArrayObject` the EA plugin complains and fails those references
  10. Andreas Kienast commented on patch set 1 09/26/23, 09:00

    MutationRepository.php:85 Reply

    Thanks for clarifying this.
  11. Andreas Kienast voted on patch set 1 CR +1 09/26/23, 09:14

  12. Oliver Hader uploaded patch set 2 CR +1 V +1 10/18/23, 13:25

  13. Oliver Hader commented on patch set 2 10/18/23, 13:25

    PolicyProvider.php:56 Reply

    Done
  14. Andreas Kienast voted on patch set 2 CR +1 10/18/23, 13:28

  15. core-ci voted on patch set 2 V +1 10/18/23, 13:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47908

  16. Benjamin Franzke voted on patch set 2 V +1 CR +1 10/19/23, 08:22

  17. Andreas Kienast voted on patch set 2 V +1 10/19/23, 08:39

  18. Benjamin Franzke voted on patch set 2 V +2 CR +2 10/19/23, 12:19

  19. Benjamin Franzke merged patch set 3 10/19/23, 12:33