-
-
Notifications
You must be signed in to change notification settings - Fork 69.6k
web_fetch blocked by SSRF guard for 198.18.0.0/15 (fake-IP) while web_search works fine #48961
Copy link
Copy link
Open
Description
Bug Description
web_fetch fails with SSRF blocked error when running behind a transparent proxy that uses fake-IP DNS (e.g., Surge Enhanced Mode on macOS). The same URLs work fine with web_search.
Environment
- macOS (Mac mini as network gateway)
- Surge Enhanced Mode (transparent proxy with fake-IP DNS)
- All DNS queries return virtual IPs in 198.18.0.0/15 (RFC 2544 benchmark range)
Error
Blocked: resolves to private/internal/special-use IP address
Every domain resolves to 198.18.x.x (Surge's fake-IP), which triggers the SSRF guard.
Root Cause
web-fetch.ts:532 calls fetchWithWebToolsNetworkGuard() without passing policy or useEnvProxy:
// web-fetch.ts L532 — no policy, no useEnvProxy
const result = await fetchWithWebToolsNetworkGuard({
url: params.url,
maxRedirects: params.maxRedirects,
timeoutSeconds: params.timeoutSeconds,
init: { headers: { ... } },
});Meanwhile, web-search.ts:926 uses withTrustedWebToolsEndpoint() which injects allowRfc2544BenchmarkRange: true + useEnvProxy: true:
// web-search.ts L926 — works correctly
return withTrustedWebToolsEndpoint({ url, ... }, async ({ response }) => { ... });The WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY in web-guarded-fetch.ts already has the correct policy:
const WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY: SsrFPolicy = {
dangerouslyAllowPrivateNetwork: true,
allowRfc2544BenchmarkRange: true,
};Suggested Fix
Either:
- Have
web-fetch.tsusewithTrustedWebToolsEndpoint()likeweb-search.tsdoes - Or pass
policy: { allowRfc2544BenchmarkRange: true }anduseEnvProxy: truetofetchWithWebToolsNetworkGuard()
Related Issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.