Skip to content

Commit

Permalink
fix: Do not leak data directory in exception (security)
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jul 9, 2024
1 parent 7559560 commit ee7ad79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ private function checkTreeForForbiddenItems(string $path) {
/** @var \SplFileInfo $file */
foreach ($iterator as $file) {
if (!$this->getFilenameValidator()->isFilenameValid($file->getBasename())) {
throw new ForbiddenException('Invalid path: ' . $file->getPathname(), false);
// Do not leak data dir
$filePath = substr($file->getPathname(), strlen($this->datadir));
throw new ForbiddenException('Invalid path: ' . $filePath, false);
}
}
}
Expand Down

0 comments on commit ee7ad79

Please sign in to comment.