Skip to content

Commit

Permalink
Don't allow redirect to external website
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Apr 8, 2024
1 parent 1186f94 commit c92a410
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions system/logout.php
Expand Up @@ -22,11 +22,5 @@

$logged = false;
unset($account_logged);

if(isset($_REQUEST['redirect']))
{
header('Location: ' . urldecode($_REQUEST['redirect']));
exit;
}
}
}
6 changes: 6 additions & 0 deletions system/pages/account/redirect.php
Expand Up @@ -12,6 +12,12 @@

$redirect = urldecode($_REQUEST['redirect']);

// should never happen, unless hacker modify the URL
if (!str_contains($_REQUEST['redirect'], BASE_URL)) {
error('Fatal error: Cannot redirect outside the website.');
return;
}

$twig->display('account.redirect.html.twig', array(
'redirect' => $redirect
));

0 comments on commit c92a410

Please sign in to comment.