Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] fix: Logout controller allows open redirects #3948

Merged
merged 11 commits into from
Jan 5, 2024
Prev Previous commit
Next Next commit
handle malformed uri
  • Loading branch information
imorland committed Jan 5, 2024
commit a1dd387bdc56179106a9bd7160476c0aca106179
6 changes: 5 additions & 1 deletion framework/core/src/Forum/Controller/LogOutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ protected function sanitizeReturnUrl(string $url, string $base): Uri
return new Uri($base);
}

$parsedUrl = new Uri($url);
try {
$parsedUrl = new Uri($url);
} catch (\InvalidArgumentException $e) {
return new Uri($base);
}

if (in_array($parsedUrl->getHost(), $this->getWhitelistedRedirectDomains())) {
return $parsedUrl;
Expand Down
Loading