MDL-75237 qformat_blackboard_six: sanitise blackboard import file paths

This commit is contained in:
Petr Skoda
2022-08-12 04:17:17 +02:00
committed by Jenkins
parent 6983a17fc0
commit 3f58d35337
+2 -2
View File
@@ -65,7 +65,7 @@ class qformat_blackboard_six extends qformat_blackboard_six_base {
* @return mixed contents array or false on failure
*/
public function get_filecontent($path) {
$fullpath = $this->tempdir . '/' . $path;
$fullpath = $this->tempdir . '/' . clean_param($path, PARAM_PATH);
if (is_file($fullpath) && is_readable($fullpath)) {
return file_get_contents($fullpath);
}
@@ -152,7 +152,7 @@ class qformat_blackboard_six extends qformat_blackboard_six_base {
}
if ($examfile->getAttribute('type') == 'assessment/x-bb-pool') {
if ($examfile->getAttribute('baseurl')) {
$fileobj->filebase = $this->tempdir. '/' . $examfile->getAttribute('baseurl');
$fileobj->filebase = $this->tempdir. '/' . clean_param($examfile->getAttribute('baseurl'), PARAM_PATH);
}
if ($content = $this->get_filecontent($examfile->getAttribute('file'))) {
$fileobj->filetype = self::FILETYPE_POOL;