Fix RVE-2023-6 (validate module_srl when uploading/deleting)

This commit is contained in:
Kijin Sung 2023-11-02 13:19:41 +09:00
parent e7eadcc6f1
commit bffa50dd15
3 changed files with 28 additions and 16 deletions

View file

@ -328,11 +328,10 @@ class EditorController extends Editor
$editor_sequence = Context::get('editor_sequence');
$primary_key = Context::get('primary_key');
$oEditorModel = getModel('editor');
$oFileController = getController('file');
$saved_doc = $oEditorModel->getSavedDoc(null);
$oFileController->setUploadInfo($editor_sequence, $saved_doc->document_srl);
FileController::setUploadInfo($editor_sequence, $saved_doc->document_srl, intval($saved_doc->module_srl));
$vars = $this->getVariables();
$this->add("editor_sequence", $editor_sequence);
$this->add("key", $primary_key);

View file

@ -255,8 +255,7 @@ class EditorModel extends Editor
$upload_status = FileModel::getUploadStatus();
Context::set('upload_status', $upload_status);
// Upload enabled (internally caching)
$oFileController = getController('file');
$oFileController->setUploadInfo($option->editor_sequence, $upload_target_srl);
FileController::setUploadInfo($option->editor_sequence, $upload_target_srl, $option->module_srl ?? 0);
// Check if the file already exists
if($upload_target_srl) $files_count = FileModel::getFilesCount($upload_target_srl);
}
@ -294,6 +293,7 @@ class EditorModel extends Editor
// Initialize options
$option = new stdClass();
$option->module_type = $type;
$option->module_srl = (int)$module_srl;
// Convert configuration keys according to type (document or comment).
if($type == 'document')