fix: enforce tool access and skip stale socket sessions - #26
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Co-authored-by: mkatwi <mkatwi@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
fixprefix.Changelog Entry
Description
Added
Changed
Deprecated
Removed
Fixed
tool_idsdirectly and execute tools hidden by UI access controls.Security
Breaking Changes
Additional Information
Bug and impact:
tool_ids; a user could invoke a private/shared-only tool by ID.get_user_ids_from_room()assumed every socket room participant had a liveSESSION_POOLentry; after a disconnect race, channel message creation had already committed and emitted before notification setup crashed and returned HTTP 400, encouraging duplicate retries.Root cause:
get_tools()callable loader did not reuse the access checks from the tools listing endpoints.SESSION_POOL.get(...)["id"]unconditionally.Fix:
can_use_tool()helper and applied it to database-backed tools and configured tool servers before registering callables.get_user_ids_from_room()through it.Validation performed:
python3 -m py_compile backend/open_webui/utils/tool_access.py backend/open_webui/utils/tools.py backend/open_webui/socket/sessions.py backend/open_webui/socket/main.py tests/test_tool_and_socket_regressions.pytests/test_tool_and_socket_regressions.py(4 passed).git diff --cached --checkTooling note:
python3 -m pytest tests/test_tool_and_socket_regressions.pycould not run becausepytestis not installed in the base image.python3 -m black ...could not run becauseblackis not installed in the base image.Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.