mirror of
https://github.com/wassname/flask-security.git
synced 2026-08-20 12:20:08 +08:00
Prevent open redirects when a malformed URL is passed to ?next=
Example: "/login?next=http:///google.com" (note 3rd slash)
This commit is contained in:
@@ -212,7 +212,7 @@ def validate_redirect_url(url):
|
||||
return False
|
||||
url_next = urlsplit(url)
|
||||
url_base = urlsplit(request.host_url)
|
||||
if url_next.netloc and url_next.netloc != url_base.netloc:
|
||||
if url_next.scheme and url_next.netloc != url_base.netloc:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user