Review 14.3 Merged

97727[SECURITY] Validate raw and decoded URL in sanitizeLocalUrl()

Benjamin Franzke CR +2 V +2 Normal +128 −23 updated 11/17/26, 10:34

Commit message

GeneralUtility::sanitizeLocalUrl() validated the percent-decoded URL
but returned the URL as given. Decoding can move the boundary between
userinfo and host, e.g. "https://example.com%2f@evil.com" decodes to
"https://example.com/@evil.com", which passed the host check, while
browsers navigate to evil.com.

The checks are now applied to both the URL as given and its decoded
representation, and both have to be considered local. Absolute URLs
are compared by their parsed scheme, host, port and path instead of
string prefixes, and URLs carrying userinfo are denied.

Relative URLs are additionally checked the way browsers parse them
according to the WHATWG URL Standard: leading C0 controls and spaces
are ignored, tabs and newlines are removed and a backslash counts as
a slash. This denies decoded representations such as "/\evil.com" or
"/<TAB>/evil.com", which browsers resolve to the host evil.com.

Root-relative paths that `parse_url()` cannot parse, e.g. "/page:2",
are no longer considered local.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2

Issues 1

Files 2

Review log 2

  1. Benjamin Franzke wrote 11/17/26, 10:31

    Hashtag added: sec-2026-11
  2. Benjamin Franzke merged patch set 2 11/17/26, 10:34