Repository navigation
Conversation
|
Codex review: found issues before merge. Summary Reproducibility: yes. from source inspection. Current main sends model provider requests through Next step before merge Security Review findings
Review detailsBest possible solution: Scope the fake-IP-only SSRF exemption to the configured model provider base host while preserving explicit Do we have a high-confidence way to reproduce the issue? Yes, from source inspection. Current main sends model provider requests through Is this the best way to solve the issue? No. The PR targets the right surface and uses the safer fake-IP-only flags, but it should scope that exemption to Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c02bf2f399db. |
0ef7bba to
963e434
Compare
|
CI surfaced a non-deterministic vitest stall in Both attempts of Local I don't have rerun rights on this repo — could a maintainer kick |
…rt SSRF guard
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 those hostnames are reachable just fine through the proxy.
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 a fake-IP-only narrow exemption
(`{ allowRfc2544BenchmarkRange: true, allowIpv6UniqueLocalRange: true }`)
into the model transport guard policy. Same pattern the public
`tools.web.fetch` policy uses (openclaw#74571) and the trusted/self-hosted
web-tools endpoint policy in `agents/tools/web-guarded-fetch.ts` (openclaw#76530).
The narrow exemption only un-blocks the two fake-IP-specific special-use
ranges — loopback, RFC1918 private networks, link-local (including
169.254.169.254 cloud metadata), and `metadata.google.internal` stay
blocked unless the operator separately opts in via
`allowPrivateNetwork`. This is a strict subset of the
`ssrfPolicyFromHttpBaseUrlAllowedHostname` allowlist path used by
adjacent plugins, addressing the codex review concern that an
`allowedHostnames` bypass would be broader than the reported fake-IP
failure.
Adds regression coverage in `provider-transport-fetch.test.ts` asserting
that:
* the policy threaded into `fetchWithSsrFGuard` only contains the
fake-IP flags (no `allowedHostnames`, no
`dangerouslyAllowPrivateNetwork`, no `allowPrivateNetwork`)
* `allowPrivateNetwork: true` from the resolved provider request
config still merges into the policy when the operator opts in
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), this closes the remaining major fake-IP
user-visible failure path.
963e434 to
4fa5b6a
Compare
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).(Re-submission of #76543 which the activity bot auto-closed for queue-quota reasons; I closed two older lower-priority PRs of mine — #72913 and #73400 — to make room.)
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