mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-26 02:44:29 +00:00
Merge branch 'fix-array-query-params' into 'master'
Allow arrays when sanitizing GET query parameters See merge request davical-project/davical!143
This commit is contained in:
commit
ff29a32103
@ -32,9 +32,21 @@ function clean_get() {
|
|||||||
|
|
||||||
foreach($_GET as $key => $value) {
|
foreach($_GET as $key => $value) {
|
||||||
// XSS is possible in both key and values
|
// XSS is possible in both key and values
|
||||||
$k = htmlspecialchars($key);
|
$key = htmlspecialchars($key);
|
||||||
$v = htmlspecialchars($value);
|
|
||||||
$temp[$k] = $v;
|
switch (gettype($value)) {
|
||||||
|
case "string":
|
||||||
|
$value = htmlspecialchars($value);
|
||||||
|
break;
|
||||||
|
case "array":
|
||||||
|
array_walk_recursive($value, function(&$v) {
|
||||||
|
if (gettype($v) == "string") {
|
||||||
|
$v = htmlspecialchars($v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$temp[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $temp;
|
return $temp;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user