Skip to content

Commit

Permalink
StudentQuiz: can we mitigate the potential XSS risks? #812360
Browse files Browse the repository at this point in the history
  • Loading branch information
Khoa Nguyen committed Aug 16, 2024
1 parent ecd900c commit 8db2022
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ function studentquiz_supports($feature) {
}
}

/**
* Callback immediately after require_login succeeds.
*/
function studentquiz_after_require_login() {
global $PAGE, $CFG, $COURSE;
if ($PAGE->activityname === 'studentquiz') {
$CFG->forceclean = true;
} else if ($catparam = optional_param('cat', null, PARAM_SEQUENCE)) {
[, $contextid] = explode(',', $catparam);
$instanceid = context::instance_by_id($contextid)->instanceid;
if (get_course_and_cm_from_cmid($instanceid, 'studentquiz', $COURSE)) {
$CFG->forceclean = true;
}
}
}

/**
* Saves a new instance of the StudentQuiz into the database
*
Expand Down

0 comments on commit 8db2022

Please sign in to comment.