MDL-59273 core: Remove mailto links support in clean_param.
This commit is contained in:
+3
-2
@@ -1033,10 +1033,11 @@ function clean_param($param, $type) {
|
||||
}
|
||||
return $param;
|
||||
|
||||
case PARAM_URL: // Allow safe ftp, http, mailto urls.
|
||||
case PARAM_URL:
|
||||
// Allow safe urls.
|
||||
$param = fix_utf8($param);
|
||||
include_once($CFG->dirroot . '/lib/validateurlsyntax.php');
|
||||
if (!empty($param) && validateUrlSyntax($param, 's?H?S?F?E?u-P-a?I?p?f?q?r?')) {
|
||||
if (!empty($param) && validateUrlSyntax($param, 's?H?S?F?E-u-P-a?I?p?f?q?r?')) {
|
||||
// All is ok, param is respected.
|
||||
} else {
|
||||
// Not really ok.
|
||||
|
||||
@@ -615,6 +615,9 @@ class core_moodlelib_testcase extends advanced_testcase {
|
||||
$this->assertSame('', clean_param('rtmp://example.com/livestream', PARAM_URL));
|
||||
$this->assertSame('', clean_param('rtmp://example.com/live&foo', PARAM_URL));
|
||||
$this->assertSame('', clean_param('rtmp://example.com/fms&mp4:path/to/file.mp4', PARAM_URL));
|
||||
$this->assertSame('', clean_param('mailto:[email protected]', PARAM_URL));
|
||||
$this->assertSame('', clean_param('mailto:[email protected]?subject=Hello%20Moodle', PARAM_URL));
|
||||
$this->assertSame('', clean_param('mailto:[email protected]?subject=Hello%20Moodle&[email protected]', PARAM_URL));
|
||||
}
|
||||
|
||||
public function test_clean_param_localurl() {
|
||||
|
||||
Reference in New Issue
Block a user