mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #19670] [MERGED] fix: Correct web search filter logic to consistently block filtered domains #128960
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/19670
Author: @kjpoccia
Created: 12/1/2025
Status: ✅ Merged
Merged: 12/2/2025
Merged by: @tjbck
Base:
dev← Head:web-search-block📝 Commits (2)
5a62faffix/adjust web search to properly block domainsc0b3becMerge branch 'dev' into web-search-block📊 Changes
2 files changed (+11 additions, -7 deletions)
View changed files
📝
backend/open_webui/retrieval/web/main.py(+1 -1)📝
backend/open_webui/utils/misc.py(+10 -6)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
🔒 Web search filtering now correctly blocks results when any resolved hostname or IP address matches a blocked domain, preventing blocked sites from appearing due to permissive hostname resolution.
Description
Related issue: #19669
This PR fixes an issue in the web search filtering logic where blocked domains (prefixed with !) were still allowed if any resolved hostname or IP address passed the filter check.
Web search filtering currently behaves incorrectly when a domain resolves to multiple hostnames or IP addresses.
In
get_filtered_results, each search result domain is resolved to:Each value is then passed individually to
is_string_allowed; if any one of those values is allowed, the entire search result is included.This behavior contradicts the expected semantics of a block rule: if any resolved hostname or IP is blocked, the entire result should be excluded.
The issue is caused by this logic:
Changed
is_string_allowednow evaluates a sequence of resolved hostnames/IPs together to ensure block rules are applied consistently to an entire search result.Additional Information
The logs show the issue clearly with the resolved hostnames logged in
get_filtered_results. The hostnames are all associated with a single result, and because the resolved IP addresses are not explicitly blocked, the YouTube result is incorrectly allowed through.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.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.