Review main Merged

66613[BUGFIX] Fix HTTP_HOST verification when HTTPS is proxied to HTTP

Benjamin Franzke CR +2 V +2 Normal +67 −15 updated 05/19/21, 14:27

Commit message

The HTTP_HOST verification failed if the proxy server port was
different to the local webserver port, due to an assumption in
hostHeaderValueMatchesTrustedHostsPattern() that concluded
that the local webserver port needs to match the default
port of the proxy server.

In case a HTTPS termination proxy is used, that
assumption can not be made, as it is common
practice to use HTTP backends behind a HTTPS
proxy in private networks. Therefore the port
is now verified against the default port of
the current webserver, not a possible proxy server.

Scenario:
 * Proxy Server HTTPS (SSL termination) => Port 443
 * Application Server HTTP => Port 80
 * Default trustedHostsPattern setting

It was previously required to configure a (slow)
trustedHostsPattern to circumvent this issue.

Review

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

Issues 1

Files 3

Review log 1822

  1. Benjamin Franzke uploaded patch set 1 11/12/20, 10:25

  2. TYPO3com voted on patch set 1 V +1 11/12/20, 10:37 Completed build in 12m 14s on Thu, 12 Nov, 10:37 AM Test Summary: 73623 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7265

  3. Benni Mack commented on patch set 1 11/12/20, 13:35

    GeneralUtility.php:2706

    This also needs to be adapted in normalizedParams
  4. Benjamin Franzke uploaded patch set 2 05/11/21, 19:10

  5. Benjamin Franzke commented on patch set 2 05/11/21, 19:10

    GeneralUtility.php:2706 Reply Unresolved

    Currently no adaption in NormalizedParams needed, as it (unfortunately) calls into GeneralUtility::isAllowedHostHeaderValue which then calls this method: https://github.com/TYPO3/TYPO3.CMS/blob/v11.2.0/typo3/sysext/core/Classes/Http/NormalizedParams.php#L588
  6. core-ci voted on patch set 2 V -1 05/11/21, 19:27 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11397

  7. Benjamin Franzke voted on patch set 2 CR -1 05/11/21, 19:44

  8. Benjamin Franzke marked it work in progress 05/11/21, 19:45

  9. Benjamin Franzke uploaded patch set 3 05/11/21, 20:16

  10. core-ci voted on patch set 3 V +1 05/11/21, 20:28 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11408

  11. Benjamin Franzke commented on patch set 3 05/11/21, 20:28

    This change is ready for review.
  12. Christian Kuhn commented on patch set 3 05/12/21, 12:50

    Maybe unit-test this to nail the scenario? Those GeneralUtility methods have decent coverage, I guess it should be doable.
  13. Benjamin Franzke uploaded patch set 4 05/13/21, 09:33

  14. Benjamin Franzke commented on patch set 4 05/13/21, 09:33

    Reply

    Ack & Done.
  15. core-ci voted on patch set 4 V +1 05/13/21, 09:43 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11471

  16. Christian Kuhn voted on patch set 4 V +1 CR +1 05/13/21, 10:33

  17. Benni Mack commented on patch set 4 05/18/21, 21:33

    Do we need to fix this in NormalizedParams as well?
  18. Benjamin Franzke commented on patch set 4 05/19/21, 04:37

    Reply

  19. Benni Mack commented on patch set 4 05/19/21, 11:52

    Reply

    Hahaha. Sorry for this!
  20. Jochen Roth voted on patch set 4 V +1 CR +1 05/19/21, 13:34

  21. Benjamin Franzke voted on patch set 4 V +2 CR +2 05/19/21, 14:27

  22. Benjamin Franzke merged patch set 5 05/19/21, 14:27