Repository navigation
Conversation
…IP proxies don't block model API calls
The model transport guarded fetch passes `{ allowPrivateNetwork: true }` to
`fetchWithSsrFGuard` only when the operator opts in via
`models.providers.<id>.request.allowPrivateNetwork`. That covers RFC1918
private networks, but not the RFC 2544 benchmark range (198.18.0.0/15) or
IPv6 ULA (fc00::/7) that fake-IP DNS proxies (sing-box / Clash / Surge)
hand back for foreign provider hostnames.
Result: every model API call (LiteLLM gateway, api.openai.com,
generativelanguage.googleapis.com, api.x.ai, api.anthropic.com, etc) on a
fake-IP setup fails with:
[security] blocked URL fetch (url-fetch) target=https://api.openai.com/...
reason=Blocked: resolves to private/internal/special-use IP address
…even though the operator already trusts that hostname via the configured
`baseUrl`. The schema on `models.providers.<id>.request` doesn't
currently accept `allowRfc2544BenchmarkRange` / `allowIpv6UniqueLocalRange`
either, so users have no way to opt in via config.
Fix: thread `ssrfPolicyFromHttpBaseUrlAllowedHostname(model.baseUrl)` into
the guard policy. Same pattern as ElevenLabs (`speech-provider.ts`),
OpenAI TTS (`tts.ts`), BlueBubbles (`client.ts`), Feishu
(`streaming-card.ts`), Google-Meet (`oauth.ts`), LM Studio
(`stream.ts`), Slack (`send.ts`), Azure Speech (`tts.ts`), Ollama
(`embedding-provider.ts`), and others. The provider hostname is operator-
configured, so allowlisting just it is no broader trust than what those
plugins already grant their own configured hostnames.
Refs openclaw#74351 (the original fake-IP IPv6 ULA report) and openclaw#74571 (the
`tools.web.fetch` companion fix). Together with openclaw#76530 (the trusted-web-
tools-endpoint companion that landed/proposed earlier), this covers the
remaining major fake-IP user-visible failure path.
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
3 of 4 tasks
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.
Summary
Companion to #74571 (public
tools.web.fetchconfig) and #76530 (trusted web-tools endpoint policy). Fixes the third major fake-IP user-visible failure path: all model API calls (LiteLLM proxies,api.openai.com,generativelanguage.googleapis.com,api.x.ai,api.anthropic.com, etc).On fake-IP DNS proxy setups (sing-box / Clash / Surge), every foreign provider hostname resolves into the 198.18.0.0/15 RFC 2544 benchmark range (or fc00::/7 IPv6 ULA). Currently the model transport guarded fetch only opts in via
requestConfig.allowPrivateNetwork, which exempts RFC1918 private networks but not the fake-IP-only special-use ranges. The schema onmodels.providers.<id>.requestdoesn't acceptallowRfc2544BenchmarkRange/allowIpv6UniqueLocalRangeeither, so users have no config-level escape hatch.Symptom every fake-IP user sees:
Change
Thread the resolved
model.baseUrlhostname throughssrfPolicyFromHttpBaseUrlAllowedHostname()so the configured provider host short-circuits the SSRF private-IP check viaallowedHostnames.Why this is safe
This is the same pattern already used in the codebase by:
extensions/elevenlabs/speech-provider.ts)extensions/openai/tts.ts)extensions/bluebubbles/src/client.ts)extensions/feishu/src/streaming-card.ts)extensions/google-meet/src/oauth.ts)extensions/lmstudio/src/stream.ts)extensions/slack/src/send.ts)Each of those plugins resolves its own configured base URL and allowlists just that hostname. This commit moves the same allowlist into the shared transport so every provider that goes through
buildGuardedModelFetch(i.e. all LLM chat / image / embedding / audio) benefits without each plugin having to copy the boilerplate.The hostname is operator-configured (via
models.providers.<id>.baseUrlor the bundled-catalog default), so allowlisting just the configured provider host is no broader trust than what the plugins above already grant their own configured hostnames.Test plan
SsrFBlockedErroron a fake-IP setup before the patchlitellm/claude-sonnet-4-6), image (litellm/gpt-image-2), Whisper transcription, andgemini-3-pro-image-previewvia internal LiteLLM all return real responsesallowedHostnamesonly short-circuits the configured base URL host)provider-transport-fetch.test.tsshould still pass; happy to add a fake-IP regression test if maintainers prefer)Refs
tools.web.fetch.ssrfPolicy🤖 Generated with Claude Code