From aac01d6d9a2d1943d88daf5ce90587052dd5208e Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 11 Jun 2025 16:04:18 -0500 Subject: [PATCH] Update pathexists endpoint to check user has access to library --- server/controllers/FileSystemController.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/controllers/FileSystemController.js b/server/controllers/FileSystemController.js index edfd869c..39663d23 100644 --- a/server/controllers/FileSystemController.js +++ b/server/controllers/FileSystemController.js @@ -108,6 +108,11 @@ class FileSystemController { return res.sendStatus(404) } + if (!req.user.checkCanAccessLibrary(libraryFolder.libraryId)) { + Logger.error(`[FileSystemController] User "${req.user.username}" attempting to check path exists for library "${libraryFolder.libraryId}" without access`) + return res.sendStatus(403) + } + const filepath = Path.join(libraryFolder.path, directory) // Ensure filepath is inside library folder (prevents directory traversal)