MDL-76091 lib: Add additional check to local URLs params

This commit is contained in:
David Woloszyn 2022-11-07 13:37:27 +08:00 committed by Jun Pataleta
parent a8019c43bf
commit 7bb44ef712

View File

@ -1105,8 +1105,9 @@ function clean_param($param, $type) {
} else if (preg_match('/^' . preg_quote($CFG->wwwroot . '/', '/') . '/i', $param)) {
// Absolute, and matches our wwwroot.
} else {
// Relative - let's make sure there are no tricks.
if (validateUrlSyntax('/' . $param, 's-u-P-a-p-f+q?r?')) {
if (validateUrlSyntax('/' . $param, 's-u-P-a-p-f+q?r?') && !preg_match('/javascript:/i', $param)) {
// Looks ok.
} else {
$param = '';