WeKnora icon indicating copy to clipboard operation
WeKnora copied to clipboard

[Feature]: Let the Bing and Google web search providers take a base URL, validated like SearXNG

Open Specstreamai opened this issue 3 weeks ago • 0 comments

Affected Component

Backend Service & API

Problem Description

The Bing provider always calls https://api.bing.microsoft.com/v7.0/search. The address is the constant at internal/infrastructure/web_search/bing.go line 20, set at line 62 with the comment "not tenant-configurable". Microsoft retired the Bing Search APIs in August 2025, so a tenant who picks Bing today gets errors, and there is no way to point the provider at a service that still serves the v7 format.

Google is next. google.go line 24 keeps the official Custom Search endpoint, and Google's Custom Search JSON API is closed to new customers and ends for existing ones on January 1, 2027.

I understand the address is fixed to prevent SSRF (line 19). My question is whether you would accept the approach SearXNG already uses for these two providers.

Proposed Solution

  • Bing: use params.BaseURL when it is set, checked with the same rules as ValidateSearxngBaseURL (searxng.go line 39: absolute http(s) URL, no query or fragment, utils.ValidateURLForSSRF). When it is empty, keep defaultBingSearchURL.
  • Google: when params.BaseURL is set and passes the same check, add option.WithEndpoint(base) to clientOpts in NewGoogleProvider.
  • Both providers already build their client with NewSearchHTTPClient, which dials through utils.SSRFSafeDialContext (proxy.go line 32), so a private address is also refused at connect time.
  • Tests next to searxng_test.go: an empty value keeps the default, a private host is rejected, a valid host is used.

Alternatives

If you would rather keep the address out of tenant hands, an operator-level setting (an environment variable read at startup) works too, and SSRF does not come into it at all.

Impact

Many users would benefit

Use Case

A team that set WeKnora up with Bing keeps web search working by pointing the provider at a Bing v7 compatible service, without changing provider.

Additional Information

We run a Bing v7 and Custom Search compatible endpoint at SpecStream, which is how I came across this. If either approach works for you, I can send the PR with the tests.

Tarek

Confirmation

  • [x] I have searched existing issues and confirmed this is a new request
  • [x] I understand this request may need discussion and evaluation

Specstreamai avatar Nov 10 '26 02:11 Specstreamai