mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-25 02:34:17 +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) {
|
||||
// XSS is possible in both key and values
|
||||
$k = htmlspecialchars($key);
|
||||
$v = htmlspecialchars($value);
|
||||
$temp[$k] = $v;
|
||||
$key = htmlspecialchars($key);
|
||||
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user