mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-76810 redirect handling: ensure return URLs are properly sanitised
This commit is contained in:
parent
6f1c9d3b53
commit
3b23ff6fec
@ -48,7 +48,7 @@ class backup_files_edit_form extends moodleform {
|
||||
$mform->setType('component', PARAM_COMPONENT);
|
||||
|
||||
$mform->addElement('hidden', 'returnurl', $this->_customdata['returnurl']);
|
||||
$mform->setType('returnurl', PARAM_URL);
|
||||
$mform->setType('returnurl', PARAM_LOCALURL);
|
||||
|
||||
$this->add_action_buttons(true, get_string('savechanges'));
|
||||
$this->set_data($this->_customdata['data']);
|
||||
|
@ -64,7 +64,7 @@ class blog_edit_external_form extends moodleform {
|
||||
$mform->setDefault('id', 0);
|
||||
|
||||
$mform->addElement('hidden', 'returnurl');
|
||||
$mform->setType('returnurl', PARAM_URL);
|
||||
$mform->setType('returnurl', PARAM_LOCALURL);
|
||||
$mform->setDefault('returnurl', 0);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ require_once($CFG->dirroot.'/course/lib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$switchrole = optional_param('switchrole', -1, PARAM_INT);
|
||||
$returnurl = optional_param('returnurl', '', PARAM_RAW);
|
||||
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
|
||||
|
||||
if (strpos($returnurl, '?') === false) {
|
||||
// Looks like somebody did not set proper page url, better go to course page.
|
||||
@ -43,7 +43,7 @@ if (strpos($returnurl, '?') === false) {
|
||||
if (strpos($returnurl, $CFG->wwwroot) !== 0) {
|
||||
$returnurl = $CFG->wwwroot.$returnurl;
|
||||
}
|
||||
$returnurl = clean_param($returnurl, PARAM_URL);
|
||||
$returnurl = clean_param($returnurl, PARAM_LOCALURL);
|
||||
}
|
||||
|
||||
$PAGE->set_url('/course/switchrole.php', array('id'=>$id, 'switchrole'=>$switchrole));
|
||||
|
@ -36,7 +36,7 @@ class mod_wiki_filesedit_form extends moodleform {
|
||||
$mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options);
|
||||
|
||||
$mform->addElement('hidden', 'returnurl', $data->returnurl);
|
||||
$mform->setType('returnurl', PARAM_URL);
|
||||
$mform->setType('returnurl', PARAM_LOCALURL);
|
||||
|
||||
$mform->addElement('hidden', 'subwiki', $data->subwikiid);
|
||||
$mform->setType('subwiki', PARAM_INT);
|
||||
|
@ -30,7 +30,7 @@ require_login();
|
||||
core_question\local\bank\helper::require_plugin_enabled('qbank_history');
|
||||
|
||||
$entryid = required_param('entryid', PARAM_INT);
|
||||
$returnurl = required_param('returnurl', PARAM_RAW);
|
||||
$returnurl = required_param('returnurl', PARAM_LOCALURL);
|
||||
|
||||
list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
|
||||
question_edit_setup('questions', '/question/bank/history/history.php');
|
||||
|
@ -48,7 +48,7 @@ define('QUESTION_PREVIEW_MAX_VARIANTS', 100);
|
||||
|
||||
// Get and validate question id.
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$returnurl = optional_param('returnurl', null, PARAM_RAW);
|
||||
$returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
|
||||
|
||||
$question = question_bank::load_question($id);
|
||||
|
||||
|
@ -61,7 +61,7 @@ if ($formaction == 'bulkchange.php') {
|
||||
|
||||
$userids = optional_param_array('userid', array(), PARAM_INT);
|
||||
$default = new moodle_url('/user/index.php', ['id' => $course->id]);
|
||||
$returnurl = new moodle_url(optional_param('returnto', $default, PARAM_URL));
|
||||
$returnurl = new moodle_url(optional_param('returnto', $default, PARAM_LOCALURL));
|
||||
|
||||
if (empty($userids)) {
|
||||
$userids = optional_param_array('bulkuser', array(), PARAM_INT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user