From a6f10ca48e923e4418adbb486881ad3942c8771a Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 11 Jun 2025 16:14:51 -0500 Subject: [PATCH] Update upload endpoint to check user has access to library --- server/controllers/MiscController.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/controllers/MiscController.js b/server/controllers/MiscController.js index 0e5ad141..c779bdd6 100644 --- a/server/controllers/MiscController.js +++ b/server/controllers/MiscController.js @@ -59,6 +59,12 @@ class MiscController { if (!library) { return res.status(404).send('Library not found') } + + if (!req.user.checkCanAccessLibrary(library.id)) { + Logger.error(`[MiscController] User "${req.user.username}" attempting to upload to library "${library.id}" without access`) + return res.sendStatus(403) + } + const folder = library.libraryFolders.find((fold) => fold.id === folderId) if (!folder) { return res.status(404).send('Folder not found')