Skip to content

Commit ee7ad79

Browse files
committed
fix: Do not leak data directory in exception (security)
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 7559560 commit ee7ad79

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/private/Files/Storage/Local.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ private function checkTreeForForbiddenItems(string $path) {
321321
/** @var \SplFileInfo $file */
322322
foreach ($iterator as $file) {
323323
if (!$this->getFilenameValidator()->isFilenameValid($file->getBasename())) {
324-
throw new ForbiddenException('Invalid path: ' . $file->getPathname(), false);
324+
// Do not leak data dir
325+
$filePath = substr($file->getPathname(), strlen($this->datadir));
326+
throw new ForbiddenException('Invalid path: ' . $filePath, false);
325327
}
326328
}
327329
}

0 commit comments

Comments
 (0)