Skip to content

Redirect URLs not starting with '/' get dropped #46533

Closed
@martinmaehlmannchefkoch

Description

Symfony version(s) affected

4.4.42

Description

By fixing bug #46317 a new bug was introduced. If a _target_path starts with 'http' or 'https' it gets dropped and the default location is returned. Using the Referer should still work.

How to reproduce

In a login form allowing _target_path, modify the value to send a value which starts with http or https.

Possible Solution

Simply modify the check to see, if it is a valid URL. Something like this could work:

if (\is_string($targetUrl) && (str_starts_with($targetUrl, '/') || filter_var($url, FILTER_VALIDATE_URL) )) {
    return $targetUrl;
}

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions