1
0
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:
Michal Čihař
2016-08-18 11:18:21 +02:00
parent 6e3282e158
commit b63bd9977c

View File

@@ -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']) {