From d64df861a2245da5e908dc2050249fa1f9a629c4 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 25 Nov 2026 00:01:50 +0100 Subject: [PATCH] refac: only accept own folders as the new parent when moving a folder (#34978) Moving a folder now only accepts a parent folder the user owns. --- backend/open_webui/routers/folders.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/open_webui/routers/folders.py b/backend/open_webui/routers/folders.py index cfddfeb33d..353c512a88 100644 --- a/backend/open_webui/routers/folders.py +++ b/backend/open_webui/routers/folders.py @@ -534,6 +534,12 @@ async def update_folder_parent_id_by_id( detail=ERROR_MESSAGES.DEFAULT('Folder already exists'), ) + if form_data.parent_id and not await Folders.get_folder_by_id_and_user_id(form_data.parent_id, user.id, db=db): + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, + detail=ERROR_MESSAGES.ACCESS_PROHIBITED, + ) + if form_data.parent_id and form_data.parent_id in await Folders.get_folder_ids_by_id_and_user_id_in_subtree( id, user.id, db=db ):