From d169f086da58082463913629a132f0dd96837d53 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 19 May 2026 20:09:56 +0200 Subject: [PATCH] fix: respect access_type in shared-chat file authorization branch (#24755) has_access_to_file granted access whenever the file was attached to a shared chat the user could read, ignoring the requested access_type. A read-only shared-chat recipient therefore satisfied write and delete checks and could delete or mutate the chat owner's attached file. Gate the shared-chat branch on read access, matching the channels branch directly above it. Co-authored-by: oxsignal Co-authored-by: Claude Opus 4.7 (1M context) --- backend/open_webui/utils/access_control/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/access_control/files.py b/backend/open_webui/utils/access_control/files.py index f134c5064d..3a4871aae3 100644 --- a/backend/open_webui/utils/access_control/files.py +++ b/backend/open_webui/utils/access_control/files.py @@ -66,7 +66,7 @@ async def has_access_to_file( # Check if the file is associated with any chats the user has access to shared_chat_ids = await Chats.get_shared_chat_ids_by_file_id(file_id, db=db) - if shared_chat_ids: + if access_type == 'read' and shared_chat_ids: accessible_ids = await AccessGrants.get_accessible_resource_ids( user_id=user.id, resource_type='shared_chat',