mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Privilege matching -- allow JS anchors. Fixes #9550
Attempts to detect a special case where a file does not actually exist, and yet should be allowed since it is used by JavaScript. So long as the anchor name doesn't contain any characters that might let it evade other checks, allow it through.
This commit is contained in:
parent
42c48efe1c
commit
bdbd8534ee
@ -42,6 +42,16 @@ function cmp_page_matches($page, & $matches, $fullwc = true) {
|
||||
$file = realpath( $g['www_path'] . '/' . ltrim($file, '/'));
|
||||
if (empty($file)) {
|
||||
/* File does not exist, or other path shenanigans */
|
||||
|
||||
/* Some tabs are just JS anchors, detect this case. */
|
||||
if ((substr($page, 0, 1) == "#") &&
|
||||
(strpos($page, '.') === false) &&
|
||||
(strpos($page, '/') === false) &&
|
||||
(strpos($page, '?') === false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Tried to query a path that does not exist */
|
||||
return false;
|
||||
}
|
||||
$page = str_replace($g['www_path'] . '/', '', $file);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user