mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
login - use parse_url to validate if the provided redirect string is actually parseable to prevent redirect. looks like https://github.com/opnsense/core/issues/4061 was incomplete
(bugfix 3c2f32ec8d)
This commit is contained in:
parent
e60e4cd9c2
commit
6bc025af17
@ -188,7 +188,12 @@ function session_auth()
|
||||
if (!empty($_GET['url'])) {
|
||||
$tmp_url_parts = parse_url($_GET['url']);
|
||||
if ($tmp_url_parts !== false) {
|
||||
$redir_uri = $tmp_url_parts['path'];
|
||||
$redir_uri = sprintf(
|
||||
'%s://%s/%s',
|
||||
isset($_SERVER['HTTPS']) ? 'https' : 'http',
|
||||
$_SERVER['HTTP_HOST'],
|
||||
ltrim($tmp_url_parts['path'], '/')
|
||||
);
|
||||
$redir_uri .= !empty($tmp_url_parts['query']) ? "?" . $tmp_url_parts['query'] : "";
|
||||
$redir_uri .= !empty($tmp_url_parts['fragment']) ? "#" . $tmp_url_parts['fragment'] : "";
|
||||
header(url_safe("Location: {$redir_uri}"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user