[PR #23452] [CLOSED] fix: enforce default-deny access control in _validate_collection_access #27201

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

📋 Pull Request Information

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

Base: devHead: fix/validate-collection-access-default-deny


📝 Commits (1)

  • 9c71abb fix: enforce default-deny access control in _validate_collection_access

📊 Changes

2 files changed (+86 additions, -6 deletions)

View changed files

📝 backend/open_webui/models/knowledge.py (+11 -0)
📝 backend/open_webui/routers/retrieval.py (+75 -6)

📄 Description

Block non-admin users from querying the knowledge-bases system collection and arbitrary knowledge base document collections via the retrieval API.

The function previously only guarded user-memory-* and file-* prefixes, letting all other collection names (including the knowledge-bases metadata collection and per-KB UUID collections) pass through unchecked.

Now uses a default-deny approach:

  • user-memory-*: ownership check (unchanged)
  • file-*: file access check (unchanged)
  • web-search-*: allow (per-session, not sensitive)
  • knowledge-bases: block outright for non-admin users
  • anything else: look up as a knowledge base UUID and enforce ownership or AccessGrants read permission; deny if not found

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/23452 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 4/6/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/validate-collection-access-default-deny` --- ### 📝 Commits (1) - [`9c71abb`](https://github.com/open-webui/open-webui/commit/9c71abbbfcd4e62cd5f996491b4f0439b5837638) fix: enforce default-deny access control in _validate_collection_access ### 📊 Changes **2 files changed** (+86 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/models/knowledge.py` (+11 -0) 📝 `backend/open_webui/routers/retrieval.py` (+75 -6) </details> ### 📄 Description Block non-admin users from querying the knowledge-bases system collection and arbitrary knowledge base document collections via the retrieval API. The function previously only guarded user-memory-* and file-* prefixes, letting all other collection names (including the knowledge-bases metadata collection and per-KB UUID collections) pass through unchecked. Now uses a default-deny approach: - user-memory-*: ownership check (unchanged) - file-*: file access check (unchanged) - web-search-*: allow (per-session, not sensitive) - knowledge-bases: block outright for non-admin users - anything else: look up as a knowledge base UUID and enforce ownership or AccessGrants read permission; deny if not found ### 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:55:53 -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#27201