mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[PR #24526] [CLOSED] fix: enforce per-file ownership when attaching files to folders/KBs #131374
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24526
Author: @Classic298
Created: 5/10/2026
Status: ❌ Closed
Base:
dev← Head:fix/file-id-ownership-folder-and-knowledge📝 Commits (1)
bdf7932fix: enforce per-file ownership when attaching files to folders/KBs📊 Changes
3 files changed (+75 additions, -2 deletions)
View changed files
📝
backend/open_webui/routers/folders.py(+23 -0)📝
backend/open_webui/routers/knowledge.py(+21 -0)📝
backend/open_webui/utils/middleware.py(+31 -2)📄 Description
Three writers accept a user-supplied file_id (or list thereof) and attach the referenced file to a resource the caller controls without checking the caller's access to the file itself:
Add a per-file read-access check at each writer (Files.check_access_by_ user_id for the folder path, has_access_to_file for the knowledge paths). Admins bypass.
Defensive layer in middleware: filter folder.data['files'] down to entries the caller can still read before they enter form_data['files'] as RAG context. Closes the window where a future writer drift, an out-of-band data write, or a revoked grant could turn folder knowledge into an exfiltration primitive at the chat sink.
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.