You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[12.x] redirect response enforce same origin (#57533)
* add `enforceSameOrigin()` method to `RedirectResponse`
it can be dangerous to redirect to a cross origin target. this is something that could possibly be exploited when using something like the "referer" header to generate your target. this method force the target URL to match the origin (scheme, host, and port) of the current request URL.
you must provide a fallback (ideally an absolute URL) if the check fails. optionally, you may disable scheme and/or port validation. you may not disable hostname validation, because honestly then what's the point?
ideally I would be able to use the `$this->request` property to directly access the scheme, host, and port, but because of how the `Request` object handles standard and non-standard ports differently than the `Uri` class, it's more reliable to turn them both into `Uri`s.
* add additional test
ports are handled weird...
* minor formatting
* formatting
---------
Co-authored-by: Taylor Otwell <[email protected]>
0 commit comments