mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #23586] bug: missing db=db parameter in filter_allowed_access_grants call in update_note_access_by_id #20020
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?
Originally created by @kuishou68 on GitHub (Apr 11, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23586
Description
In
backend/open_webui/routers/notes.py, theupdate_note_access_by_idendpoint callsfilter_allowed_access_grantswithout passing thedb(SQLAlchemy session) parameter. This means the function has no database session available when it tries to check user group-based permissions.Bug Location
File:
backend/open_webui/routers/notes.pyFunction:
update_note_access_by_idLine: ~345
Compare with
update_note_by_idin the same file (line ~281), which correctly passesdb=db:Impact
The
filter_allowed_access_grantsfunction (inbackend/open_webui/utils/access_control/__init__.py) callshas_permission()internally, which callsGroups.get_groups_by_member_id(user_id, db=db). Without a validdbsession, group-based permission lookups will fail with an error (or silently useNoneas the db session, which the ORM layer may handle incorrectly).This means that when a non-admin user with group-based
sharing.public_notesoraccess_grants.allow_userspermissions tries to call thePOST /{id}/access/updateendpoint, the permission check will fail even though the user is legitimately allowed to update note access grants.Fix
Pass
db=dbto thefilter_allowed_access_grantscall inupdate_note_access_by_id:Environment
sharing.public_notespermission tries to update note access@kuishou68 commented on GitHub (Apr 11, 2026):
I've opened PR #23587 (https://github.com/open-webui/open-webui/pull/23587) to fix this issue.
The fix is a one-line change: adding the missing
db=dbkeyword argument to thefilter_allowed_access_grantscall inupdate_note_access_by_id, consistent with the identical call inupdate_note_by_idin the same file.