[PR #23490] [CLOSED] fix: restrict shared chat file access to require valid share_id #27221

Closed
opened 2026-04-20 06:56:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23490
Author: @Classic298
Created: 4/7/2026
Status: Closed

Base: devHead: fix/file-access-shared-chat


📝 Commits (1)

  • 6360b4c fix: restrict shared chat file access to require valid share_id

📊 Changes

9 files changed (+74 additions, -26 deletions)

View changed files

📝 backend/open_webui/routers/files.py (+32 -10)
📝 backend/open_webui/utils/access_control/files.py (+12 -5)
📝 src/lib/components/chat/Messages/Markdown/HTMLToken.svelte (+2 -2)
📝 src/lib/components/chat/Messages/Markdown/MarkdownInlineTokens.svelte (+2 -1)
📝 src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte (+2 -2)
📝 src/lib/components/common/Image.svelte (+9 -2)
📝 src/lib/stores/index.ts (+1 -0)
📝 src/lib/utils/index.ts (+7 -2)
📝 src/routes/s/[id]/+page.svelte (+7 -2)

📄 Description

Previously, any authenticated user could access files attached to any shared chat by guessing the file UUID. The has_access_to_file function granted access if a file appeared in ANY shared chat, without verifying the requester had legitimate access to that specific share.

Backend: has_access_to_file now requires either chat ownership or a matching share_id to grant shared-chat file access. All file endpoints accept an optional share_id query parameter.

Frontend: A shareId store is set when viewing a shared chat (/s/{id}) and cleared on navigation away. Markdown components and the token replacement utility append ?share_id= to file content URLs when set, enabling authorized file access for shared chat viewers.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23490 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 4/7/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/file-access-shared-chat` --- ### 📝 Commits (1) - [`6360b4c`](https://github.com/open-webui/open-webui/commit/6360b4c34e966305e9fa3d2c986dad361573a217) fix: restrict shared chat file access to require valid share_id ### 📊 Changes **9 files changed** (+74 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/files.py` (+32 -10) 📝 `backend/open_webui/utils/access_control/files.py` (+12 -5) 📝 `src/lib/components/chat/Messages/Markdown/HTMLToken.svelte` (+2 -2) 📝 `src/lib/components/chat/Messages/Markdown/MarkdownInlineTokens.svelte` (+2 -1) 📝 `src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte` (+2 -2) 📝 `src/lib/components/common/Image.svelte` (+9 -2) 📝 `src/lib/stores/index.ts` (+1 -0) 📝 `src/lib/utils/index.ts` (+7 -2) 📝 `src/routes/s/[id]/+page.svelte` (+7 -2) </details> ### 📄 Description Previously, any authenticated user could access files attached to any shared chat by guessing the file UUID. The has_access_to_file function granted access if a file appeared in ANY shared chat, without verifying the requester had legitimate access to that specific share. Backend: has_access_to_file now requires either chat ownership or a matching share_id to grant shared-chat file access. All file endpoints accept an optional share_id query parameter. Frontend: A shareId store is set when viewing a shared chat (/s/{id}) and cleared on navigation away. Markdown components and the token replacement utility append ?share_id= to file content URLs when set, enabling authorized file access for shared chat viewers. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [X] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 06:56:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#27221