[GH-ISSUE #17432] issue: Incorrect logic about collection permission #56948

Closed
opened 2026-05-05 20:16:50 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @chayaziv on GitHub (Sep 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17432

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.6.27

Ollama Version (if applicable)

No response

Operating System

Windows 10

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

When a user logs in with USER permission and creates a private collection and uploads a file to the collection, then attaches the private collection to the chat with # and asks a question about the content - the model should provide an answer based on the content of the file.

Actual Behavior

Due to a logical issue in checking permissions for the collection when BY_PASS_EMBEDDING = TRUE, the model cannot see the files in the collection and therefore responds with an answer like: "I do not see the file..."

Steps to Reproduce

  1. set BYPASS_EMBEDDING_AND_RETRIEVAL = TRUE.

  2. Log in with USER permission

  3. Create a private collection without a group

  4. Add the attach file to the collection

  5. Add the collection to the chat with #

  6. And ask: "Which design library should be used according to the instructions in the file?"

React Homework Assignment Requirements.pdf

Logs & Screenshots

Additional Information

🛠 Root Cause Analysis

The issue is in the file:
backend/open_webui/retrieval/utils.py at lines 582-585:

if knowledge_base and (
    user.role == "admin"
    or has_access(user.id, "read", knowledge_base.access_control)  # Missing owner check
):

The function has_access does not include the owner in the list of permitted users when the knowledge base is private.


Comparison with Working Code

In the file:
backend/open_webui/models/knowledge.py (lines 171-174)
the correct pattern is used:

if knowledge_base.user_id == user_id  # Owner check
or has_access(user_id, permission, knowledge_base.access_control)

💡 Proposed Fix

Add the missing owner check in the file:
backend/open_webui/retrieval/utils.py

if knowledge_base and (
    user.role == "admin"
    or knowledge_base.user_id == user.id  # Add this line
    or has_access(user.id, "read", knowledge_base.access_control)
):
Originally created by @chayaziv on GitHub (Sep 14, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/17432 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.27 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 10 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior When a user logs in with USER permission and creates a private collection and uploads a file to the collection, then attaches the private collection to the chat with # and asks a question about the content - **the model should provide an answer based on the content of the file.** ### Actual Behavior Due to a logical issue in checking permissions for the collection when **BY_PASS_EMBEDDING = TRUE**, the model cannot see the files in the collection and therefore responds with an answer like: "I do not see the file..." ### Steps to Reproduce 1. set BYPASS_EMBEDDING_AND_RETRIEVAL = **TRUE**. 2. Log in with **USER** permission 3. Create a **private** collection **without** a group 4. Add the attach file to the collection 5. Add the collection to the chat with # 6. And ask: "Which design library should be used according to the instructions in the file?" [React Homework Assignment Requirements.pdf](https://github.com/user-attachments/files/22318617/React.Homework.Assignment.Requirements.pdf) ### Logs & Screenshots - ### Additional Information # 🛠 Root Cause Analysis The issue is in the file: `backend/open_webui/retrieval/utils.py` at lines **582-585**: ```python if knowledge_base and ( user.role == "admin" or has_access(user.id, "read", knowledge_base.access_control) # Missing owner check ): ``` The function `has_access` **does not include the owner** in the list of permitted users when the knowledge base is private. --- # ✅ Comparison with Working Code In the file: `backend/open_webui/models/knowledge.py` (lines **171-174**) the correct pattern is used: ```python if knowledge_base.user_id == user_id # Owner check or has_access(user_id, permission, knowledge_base.access_control) ``` --- # 💡 Proposed Fix Add the missing owner check in the file: `backend/open_webui/retrieval/utils.py` ```python if knowledge_base and ( user.role == "admin" or knowledge_base.user_id == user.id # Add this line or has_access(user.id, "read", knowledge_base.access_control) ): ```
GiteaMirror added the bug label 2026-05-05 20:16:50 -05:00
Author
Owner

@tjbck commented on GitHub (Sep 15, 2025):

Addressed with a51f0c30ec in dev!

<!-- gh-comment-id:3293044821 --> @tjbck commented on GitHub (Sep 15, 2025): Addressed with a51f0c30ec1472d71487eab3e15d0351a2716b12 in dev!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#56948