Skip to content

fix: allow RFC 2544 benchmark range in web tools SSRF guard - #31176

Closed
sunkinux wants to merge 1 commit into
openclaw:mainfrom
sunkinux:fix-fake-ip-ssrf-guard
Closed

sunkinux wants to merge 1 commit into
openclaw:mainfrom
sunkinux:fix-fake-ip-ssrf-guard

Conversation

@sunkinux

@sunkinux sunkinux commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

This fixes web_fetch being blocked when using Clash fake-ip mode, which returns addresses in the 198.18.0.0/15 range.

Problem

When using Clash with fake-ip mode, DNS queries return addresses in the 198.18.0.0/15 range (RFC 2544 benchmark range). OpenClaw's SSRF guard was blocking these addresses as "private/internal/special-use IP", causing web_fetch to fail.

Solution

  1. Add allowRfc2544BenchmarkRange: true to WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY
  2. Pass policy to fetchWithSsrFGuard in fetchWithWebToolsNetworkGuard

Testing

Tested with Clash fake-ip mode enabled, web_fetch now works correctly with GitHub, Baidu, and other sites.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Mar 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0010f5b6fb

ℹ️ 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".

Comment thread src/agents/tools/web-guarded-fetch.ts Outdated
@@ -35,6 +36,7 @@ export async function fetchWithWebToolsNetworkGuard(
...rest,
timeoutMs: resolveTimeoutMs({ timeoutMs: rest.timeoutMs, timeoutSeconds }),
proxy: "env",
policy: WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep strict endpoints on default SSRF policy

Setting policy: WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY in fetchWithWebToolsNetworkGuard makes every caller use the relaxed policy, which unintentionally disables strict SSRF behavior for withStrictWebToolsEndpoint (used for citation redirect resolution). After this change, URLs resolved through the strict path can now reach private/internal/special-use targets that were previously blocked, so the strict/trusted split is lost. Apply the relaxed policy only at trusted call sites rather than in the shared guard helper.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR enables web_fetch to work with Clash fake-ip mode by allowing the RFC 2544 benchmark range (198.18.0.0/15) in the SSRF guard. The changes include:

  • Added allowRfc2544BenchmarkRange: true to WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY to permit addresses in the 198.18.0.0/15 range
  • Fixed a bug where the policy constant was defined but not actually being passed to fetchWithSsrFGuard

The RFC 2544 range is designated for network benchmarking and is used by Clash fake-ip mode for DNS responses. Since the policy already permits private networks via dangerouslyAllowPrivateNetwork: true, this change is consistent with the existing security posture.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The changes are minimal, targeted, and fix a legitimate use case (Clash fake-ip mode). The RFC 2544 benchmark range (198.18.0.0/15) is a standard range for testing and is not routable on the public internet. The second change fixes a bug where the trusted policy wasn't being applied. Since the policy already allows private networks, this adds minimal additional security risk. Score is 4/5 rather than 5/5 due to lack of automated tests.
  • No files require special attention

Last reviewed commit: 0010f5b

Add allowRfc2544BenchmarkRange: true to WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY
to fix web_fetch being blocked when using Clash fake-ip mode (198.18.0.0/15).

This only affects withTrustedWebToolsEndpoint, keeping strict SSRF
behavior for withStrictWebToolsEndpoint (citation redirect resolution).
@sunkinux
sunkinux force-pushed the fix-fake-ip-ssrf-guard branch from 0010f5b to 087d122 Compare March 2, 2026 02:21
steipete added a commit that referenced this pull request Mar 2, 2026
@steipete

steipete commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Landed via maintainer squash + fixup workflow. Thank you @sunkinux.

What we did:

  • Rebased flow: main -> temp/land-31176
  • Applied PR patch
  • Added targeted regression tests for trusted vs strict web-tools SSRF policy behavior
  • Added changelog entry
  • Fixed one unrelated current-main outbound test expectation drift surfaced by gate (Telegram DM topic fallback key/from)
  • Ran full gate before commit: pnpm lint && pnpm build && pnpm test (pass)
  • Added co-author trailer and landed on main

SHAs:

  • Temp landing commit before rebase: ca8968fe8
  • Final landed commit on main: e1bf9591c

Thanks again for the contribution.

@steipete steipete closed this Mar 2, 2026
steipete added a commit that referenced this pull request Mar 2, 2026
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
hanqizheng pushed a commit to hanqizheng/openclaw that referenced this pull request Mar 2, 2026
oskarfreye pushed a commit to oskarfreye/openclaw that referenced this pull request Mar 2, 2026
@toby1991

toby1991 commented Mar 3, 2026

Copy link
Copy Markdown

web_fetch is still down..

dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants