Review 12.4 Merged

81279[BUGFIX] Avoid redirect loop for empty redirect url

Stefan Bürk CR +2 V +2 Easy +17 −1 updated 09/28/23, 09:22

Commit message

Sending a redirect response with a empty `Location` is
invalid per RFC. Browser vendor are dealing differntly
with it.

* Firefox executes a redirect to the current url, leading
  to an `endless` redirect chain - stopping it after some
  recursions with a coresponding notice in the network tab.
* Chrome determines this and is doing nothing at all with
  it - leading to a white page.

From the [1] RFC regarding invalid URI spec for `Location`:

> Note: Some recipients attempt to recover from Location
>       fields that are not valid URI references. This
>       specification does not mandate or define such
>       processing, but does allow it for the sake of
>       robustness.

A matching redirect record with a manually entered `/` as
redirect target leads in TYPO3 v11 to this behaviour. This
can be mitigated by selecting the corresponding site root.

For TYPO3 v12 and upwards a change in the LinkHandling has
been introduced which properly handles the `/` in the link
generation and correctly returning a `/` as redirect url.
That change has quite some impact and is not reasonable to
be backported to TYPO3 v11 within #100958.

This change adds an additionally guard to the `RedirectHandler`
to handle empty redirect urls as endless loop, just logging
it and not responding with an redirect. This helps in v11 and
keeps a safety guard for the future in this place.

[1] https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.2

Review

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

Issues 2

Files 1

Review log 34

  1. Stefan Bürk commented on patch set 1 09/28/23, 09:07

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 09/28/23, 09:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47274

  3. Stefan Bürk voted on patch set 1 V +2 CR +2 09/28/23, 09:22

  4. Stefan Bürk merged patch set 2 09/28/23, 09:22