tools: add ssrfPolicy for web_fetch (TUN/proxy fake-IP support)#44609
tools: add ssrfPolicy for web_fetch (TUN/proxy fake-IP support)#44609zhouhe-xydt wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds a Key changes:
Confidence Score: 4/5
Last reviewed commit: 41025c7 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41025c7307
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| cacheTtlMs: resolveCacheTtlMs(fetch?.cacheTtlMinutes, DEFAULT_CACHE_TTL_MINUTES), | ||
| userAgent, | ||
| readabilityEnabled, | ||
| ssrfPolicy: resolveFetchSsrFPolicy(fetch), |
There was a problem hiding this comment.
Include SSRF policy in web_fetch cache key
This new ssrfPolicy input changes whether private-network targets are fetchable, but runWebFetch still caches only by URL/extract mode/maxChars and returns cached content before any SSRF check. In a mixed-policy process (for example, one agent/config with dangerouslyAllowPrivateNetwork: true and another with strict defaults), a permissive request can populate cache for a private target and a later strict request will receive that cached payload instead of being blocked until TTL expiry.
Useful? React with 👍 / 👎.
|
This not only affects the |
Add
ssrfPolicyforweb_fetch(TUN/proxy fake-IP support)Fixes #44527
Problem
web_fetchfails under TUN-mode proxies (e.g. Clash Verge) because:198.18.x.x,10.x.x.x)web_fetchSSRF checks block private/internal IPsBlocked: resolves to private/internal/special-use IP addressSolution
Add
tools.web.fetch.ssrfPolicyso operators can opt in to allowing private-network resolution when using TUN/proxy setups.Changes
tools.web.fetch.ssrfPolicywithdangerouslyAllowPrivateNetwork,allowPrivateNetwork(legacy),allowedHostnames,hostnameAllowlist, andallowRfc2544BenchmarkRangessrfPolicyfrom config and pass it tofetchWithWebToolsNetworkGuarddocs/tools/web.md,docs/gateway/configuration-reference.md, anddocs/gateway/security/index.mdssrfPolicy.dangerouslyAllowPrivateNetwork: trueallowing private IPsUsage
{ "tools": { "web": { "fetch": { "ssrfPolicy": { "dangerouslyAllowPrivateNetwork": true } } } } }Design notes
dangerouslyAllowPrivateNetwork: false)browser.ssrfPolicyfor consistency