Review main Merged

84426[BUGFIX] Avoid exceptions due to non-HTTP URI values in CSP reporter

Georg Ringer CR +2 V +2 Easy +37 −2 updated 08/06/24, 10:12

Commit message

CSP violation reports might contain non-HTTP referrer URIs, like
`android-app://com.google.android.googlequicksearchbox/`, which
results in an exception, since the `android-app:` scheme is not
supported by the model in `\TYPO3\CMS\Core\Http\Uri`.

This change introduces the `Uri::fromAnyScheme()` factory method,
which instructs the parsing logic to skip the scheme validation.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Georg Ringer +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1823

  1. Georg Ringer uploaded patch set 1 05/27/24, 17:55

  2. Georg Ringer commented on patch set 1 05/27/24, 17:55

    This change is ready for review.
  3. core-ci voted on patch set 1 V -1 05/27/24, 18:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58351

  4. Georg Ringer uploaded patch set 2 V -1 05/27/24, 20:27

  5. core-ci voted on patch set 2 V +1 05/27/24, 20:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58353

  6. Oliver Hader commented on patch set 2 CR -1 06/13/24, 08:18

    On it..
  7. Oliver Hader uploaded patch set 3 CR -1 V +1 06/13/24, 08:53

  8. core-ci voted on patch set 3 V +1 06/13/24, 09:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59434

  9. Garvin Hicking commented on patch set 3 CR +1 V +1 06/13/24, 09:04

    Thank you! I think this is a good solution without needing specific exemptions :-)
  10. Mathias Brodala commented on patch set 3 CR -1 07/03/24, 07:52

    Uri.php:112

    IMO we should avoid prehistoric concepts like bitwise options/flags and embrace more modern approaches instead: - use a literal named argument, e.g. $anyScheme - use an array or variadic argument of options, use an enum within - use an additional named constructor like Uri::fromAnyScheme($uri) - maybe more
  11. Oliver Hader commented on patch set 3 07/03/24, 09:36

    Uri.php:112 Reply

    Thanks for your feedback. I personally dislike multiple/variadic options and default argument values... However, the static factory method `fromAnyScheme($uri)` seems to be a good compromise, that's a good idea, thanks! 👍
  12. Oliver Hader uploaded patch set 4 CR +1 V +1 07/03/24, 12:02

  13. Oliver Hader commented on patch set 4 07/03/24, 12:03

    Uri.php:112 Reply

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

  15. Garvin Hicking commented on patch set 4 CR +1 V +1 07/03/24, 12:34

    Cool, that's easier to read, thanks! :)
  16. Oliver Hader commented on patch set 4 CR -1 07/04/24, 06:15

    Small adjustment...
  17. Oliver Hader uploaded patch set 5 CR +1 V +1 07/04/24, 06:22

  18. core-ci voted on patch set 5 V +1 07/04/24, 06:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60948

  19. Oliver Hader wrote 07/04/24, 08:27

    Topic set to csp
  20. Garvin Hicking voted on patch set 5 CR +1 V +1 07/12/24, 08:38

  21. Georg Ringer voted on patch set 5 CR +1 V +1 08/02/24, 11:56

  22. Christian Kuhn voted on patch set 5 CR +2 V +2 08/06/24, 10:05

  23. Christian Kuhn merged patch set 6 08/06/24, 10:12