Skip to content

Commit 15a5aae

Browse files
Chris ZhangChris Zhang
authored andcommitted
fix(web-tools): exempt fake-IP DNS ranges from trusted/self-hosted SSRF 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 #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 #74351 (the original fake-IP IPv6 ULA report). The user-facing `tools.web.fetch` path was fixed in #74571; this commit covers the parallel trusted-endpoint path that #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.
1 parent 882ddc4 commit 15a5aae

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/agents/tools/web-guarded-fetch.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@ import {
77
} from "../../infra/net/fetch-guard.js";
88
import type { SsrFPolicy } from "../../infra/net/ssrf.js";
99

10-
const WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY: SsrFPolicy = {};
10+
// Allow fake-IP DNS proxy ranges (RFC 2544 benchmark 198.18.0.0/15 and IPv6
11+
// ULA fc00::/7) so trusted public web-tool endpoints (Tavily, Brave, Exa,
12+
// hosted Firecrawl, etc.) work behind sing-box / Clash / Surge fake-IP
13+
// setups. The trusted path still rejects RFC1918 private networks, link-
14+
// local, loopback, and cloud-metadata hostnames — only the fake-IP-only
15+
// special-use ranges are exempted, matching how the public web_fetch policy
16+
// was extended in #74571. Without this, every web-search provider that
17+
// routes through the same trusted-endpoint helper still fails with "Blocked:
18+
// resolves to private/internal/special-use IP address" for every foreign
19+
// domain on a fake-IP proxy.
20+
const WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY: SsrFPolicy = {
21+
allowRfc2544BenchmarkRange: true,
22+
allowIpv6UniqueLocalRange: true,
23+
};
1124
const WEB_TOOLS_SELF_HOSTED_NETWORK_SSRF_POLICY: SsrFPolicy = {
1225
dangerouslyAllowPrivateNetwork: true,
1326
allowRfc2544BenchmarkRange: true,
27+
allowIpv6UniqueLocalRange: true,
1428
};
1529

1630
type WebToolGuardedFetchOptions = Omit<

0 commit comments

Comments
 (0)