Skip to content

Commit

Permalink
Fix Parameter based Indirect Object Referencing leading to private fi…
Browse files Browse the repository at this point in the history
…le exposure
  • Loading branch information
fguillot committed Jun 3, 2023
1 parent cda45dd commit 437b141
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ protected function getTask()
* @access protected
* @return array
* @throws PageNotFoundException
* @throws AccessForbiddenException
*/
protected function getFile()
{
$project_id = $this->request->getIntegerParam('project_id');
$task_id = $this->request->getIntegerParam('task_id');
$file_id = $this->request->getIntegerParam('file_id');
$model = 'projectFileModel';
Expand All @@ -108,7 +108,11 @@ protected function getFile()
}

if (isset($file['task_id']) && $file['task_id'] != $task_id) {
throw new AccessForbiddenException();
throw new PageNotFoundException();
}

if (isset($file['project_id']) && $file['project_id'] != $project_id) {
throw new PageNotFoundException();
}

$file['model'] = $model;
Expand Down

0 comments on commit 437b141

Please sign in to comment.