You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-31 10:54:46 +03:00
Stricter validation of NavigationLogoLink
It now has to be URL including scheme. Otherwise it's not really possible to validate it for being just http/https. Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
@@ -106,11 +106,9 @@ class NavigationHeader
|
||||
$logoLink = trim(
|
||||
htmlspecialchars($GLOBALS['cfg']['NavigationLogoLink'])
|
||||
);
|
||||
// prevent XSS, see PMASA-2013-9
|
||||
// if link has protocol, allow only http and https
|
||||
if (preg_match('/^[a-z]+:/i', $logoLink)
|
||||
&& !preg_match('/^https?:/i', $logoLink)
|
||||
) {
|
||||
$parsed = parse_url($logoLink);
|
||||
/* Allow only links with http/https */
|
||||
if (! isset($parsed['scheme']) || ! in_array(strtolower($parsed['scheme']), array('http', 'https'))) {
|
||||
$logoLink = 'index.php';
|
||||
}
|
||||
switch ($GLOBALS['cfg']['NavigationLogoLinkWindow']) {
|
||||
|
||||
Reference in New Issue
Block a user