Fix invalid redirection using the path of an external domain
Fixes #1554
This commit is contained in:
parent
5baafe5001
commit
abe033be85
5 changed files with 54 additions and 16 deletions
application/front/controller/visitor
|
@ -142,6 +142,13 @@ abstract class ShaarliVisitorController
|
|||
|
||||
if (null !== $referer) {
|
||||
$currentUrl = parse_url($referer);
|
||||
// If the referer is not related to Shaarli instance, redirect to default
|
||||
if (isset($currentUrl['host'])
|
||||
&& strpos(index_url($this->container->environment), $currentUrl['host']) === false
|
||||
) {
|
||||
return $response->withRedirect($defaultPath);
|
||||
}
|
||||
|
||||
parse_str($currentUrl['query'] ?? '', $params);
|
||||
$path = $currentUrl['path'] ?? $defaultPath;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue