Repository navigation
Conversation
…RF policy
The trusted-endpoint helper used by Tavily / Brave / Exa / hosted Firecrawl
search providers passes a policy of `{}` to fetchWithSsrFGuard. On fake-IP
proxy setups (sing-box / Clash / Surge), every public domain resolves to the
198.18.0.0/15 RFC 2544 benchmark range or fc00::/7 IPv6 ULA, which is
unconditionally blocked unless the policy opts in.
Apply the same opt-in that openclaw#74571 added to the public `tools.web.fetch`
config to the hardcoded trusted/self-hosted web-tool policies:
WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY:
+ allowRfc2544BenchmarkRange: true
+ allowIpv6UniqueLocalRange: true
WEB_TOOLS_SELF_HOSTED_NETWORK_SSRF_POLICY:
+ allowIpv6UniqueLocalRange: true (companion to the existing
allowRfc2544BenchmarkRange entry)
Real-world impact: `api.tavily.com` (and every other trusted-endpoint
provider) currently fails with "Blocked: resolves to private/internal/
special-use IP address" on every fake-IP proxy user, even when they have
`tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange: true` configured.
The trusted endpoint path doesn't read user config; it uses the hardcoded
policy above.
Refs openclaw#74351 (the original fake-IP IPv6 ULA report). The user-facing
`tools.web.fetch` path was fixed in openclaw#74571; this commit covers the parallel
trusted-endpoint path that openclaw#74571 didn't touch.
Open question for maintainers (not blocking this fix): the same fake-IP
exemption is currently impossible to configure for `browser.ssrfPolicy` and
`models.providers.*.request` — both schemas reject `allowRfc2544BenchmarkRange`
and `allowIpv6UniqueLocalRange`. Should those schemas be extended to mirror
`tools.web.fetch.ssrfPolicy`, or is the deliberate design that browser
navigation and provider HTTP must rely on `dangerouslyAllowPrivateNetwork`
plus DNS-level fake-IP exemptions outside OpenClaw? Happy to follow up
separately if the schema extension is desired.
|
Codex review: found issues before merge. Summary Reproducibility: yes. Current main passes Next step before merge Security Review findings
Review detailsBest possible solution: Land a tested policy update only after maintainers accept the trusted-helper SSRF exception, with Do we have a high-confidence way to reproduce the issue? Yes. Current main passes Is this the best way to solve the issue? No. The direction is plausible, but this PR is not the best mergeable form because it leaves failing test expectations, lacks regression coverage and changelog, and needs explicit maintainer/security acceptance for the default trusted-policy widening. Full review comments:
Overall correctness: patch is incorrect Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 39bc94e4ddf5. |
…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.
…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.
…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.
…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.
Summary
The trusted-endpoint helper used by Tavily / Brave / Exa / hosted Firecrawl search providers passes a policy of
{}tofetchWithSsrFGuard. On fake-IP proxy setups (sing-box / Clash / Surge), every public domain resolves to the 198.18.0.0/15 RFC 2544 benchmark range or fc00::/7 IPv6 ULA, which is unconditionally blocked unless the policy opts in.#74571 extended the public
tools.web.fetch.ssrfPolicyto acceptallowRfc2544BenchmarkRange/allowIpv6UniqueLocalRange, but the parallel hardcoded trusted/self-hosted web-tool policies inweb-guarded-fetch.ts:10-14still pass{}and a partial exemption respectively, so users on fake-IP proxies still see:…even after configuring
tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange: truein their config — becauseweb_searchproviders don't read user config, they use the hardcoded trusted policy.Change
The trusted path still rejects RFC1918 private networks, link-local, loopback, and cloud-metadata hostnames — only the fake-IP-only special-use ranges are exempted, matching how
tools.web.fetch.ssrfPolicywas extended in #74571.Test plan
pnpm openclaw infer web search --query "test"failed withSsrFBlockedErroron a Surge fake-IP setup before the patchweb_fetchagainst various non-fake-IP destinations — still blocked as expected (no regression on real public IPs)pnpm test src/agents/tools/web-guarded-fetch.test.ts(added cases would be welcome — happy to add if the maintainers prefer it in this PR)Refs
Open question for maintainers (separate, not blocking this fix)
The same fake-IP exemption is currently impossible to configure for two other ssrf-policy paths:
browser.ssrfPolicy— schema rejectsallowRfc2544BenchmarkRangeandallowIpv6UniqueLocalRangemodels.providers.*.request— same rejectionReal-world impact for fake-IP proxy users (we see this on
api.openai.com,generativelanguage.googleapis.com, image-describe pulling remote reference images, etc):Should those schemas be extended to mirror
tools.web.fetch.ssrfPolicy, or is the deliberate design that browser navigation and provider HTTP must rely solely ondangerouslyAllowPrivateNetworkplus DNS-level fake-IP exemptions outside OpenClaw?Happy to follow up with separate PRs if the schema extension is desired — wanted to surface the question while you're already in the fake-IP context. Not part of this PR.
🤖 Generated with Claude Code