Review main Merged

71610[BUGFIX] Ensure cyrilic work as regexp redirects capture group

Susi Moog CR +2 V +2 Normal +117 −20 updated 10/19/21, 14:00

Commit message

Requests with special characters like for ex.
cyrilic characters in it would be rawurlencoded
by the used Uri() components. Webservers like
Apache normally decodeds them for the php process.

'RedirectService::matchRedirect()' has been
using rawurldecode() to decode the path to work
properly to resolve path with such characters.

RegExp redirects may have capture groups which
should be replaced in the target url for the
redirect. The corresponding replace method has
not been working with urldecoded variant and as
such the encoded value was used.

Furthermore if for ex. cyrilic characters where
in the path, and not only part of the capture
group the seconady preg_match in that replace
method did not matched the regexp which has
matched as redirect. Additional it could be
that cyrilic characters would be used for
the regexp in the query part, if respect
query parameters options is enabled for the
redirect.

This patch adds a rawurldecode() call to decode
the path and query, if needed,  to the method
`RedirectService::replaceRegExpCaptureGroup()`
and covers these cases with unit tests.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Jochen Roth +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Jochen Roth +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1116

  1. Susi Moog uploaded patch set 1 10/13/21, 06:14

  2. core-ci voted on patch set 1 V +1 10/13/21, 06:29 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18005

  3. Stefan Bürk commented on patch set 1 CR -1 10/13/21, 09:06

    See code comment. Besides this there are no tests in place for it. Will add tests when I have time for it (at the weekend) and test/verify if the first matching place should be adjusted to.

    RedirectService.php:376

    That's not the first place the regexp would be matched, that's done before. Should be checked if it have to be done there first.
  4. Stefan Bürk uploaded patch set 2 10/18/21, 15:46

  5. Stefan Bürk updated the commit message in patch set 3 10/18/21, 15:59

  6. Stefan Bürk updated the commit message in patch set 4 10/18/21, 16:00

  7. core-ci voted on patch set 2 V +1 10/18/21, 16:05 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18280

  8. core-ci voted on patch set 4 V +1 10/18/21, 16:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18282

  9. core-ci voted on patch set 3 V +1 10/18/21, 16:18 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18281

  10. Stefan Bürk updated the commit message in patch set 5 10/18/21, 17:00

  11. Stefan Bürk commented on patch set 5 10/18/21, 17:12

    Added tests and added another rawurldecode() needed, found during adding tests.

    RedirectService.php:376 Reply

    Added here another rawurldecode() for the query part.
  12. Stefan Bürk wrote 10/18/21, 17:12

    Removed reviewer Stefan Bürk.
  13. core-ci voted on patch set 5 V +1 10/18/21, 17:14 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18289

  14. Jochen Roth voted on patch set 5 V +1 CR +1 10/19/21, 13:59

  15. Christian Kuhn voted on patch set 5 V +2 CR +2 10/19/21, 14:00

  16. Christian Kuhn merged patch set 6 10/19/21, 14:00