Skip to content

fix(web-fetch): expose ssrfPolicy.allowRfc2544BenchmarkRange config option#25258

Closed
byungsker wants to merge 1 commit intoopenclaw:mainfrom
byungsker:fix/web-fetch-ssrf-allow-rfc2544-benchmark-range
Closed

fix(web-fetch): expose ssrfPolicy.allowRfc2544BenchmarkRange config option#25258
byungsker wants to merge 1 commit intoopenclaw:mainfrom
byungsker:fix/web-fetch-ssrf-allow-rfc2544-benchmark-range

Conversation

@byungsker
Copy link
Contributor

@byungsker byungsker commented Feb 24, 2026

Problem

web_fetch unconditionally applied the SSRF block list including the RFC 2544 benchmark range (198.18.0.0/15). Clash/mihomo and similar proxy tools use this range for fake-ip mode: DNS queries return virtual IPs in 198.18.x.x that are transparently forwarded to the real destination by the kernel.

This made web_fetch completely unusable for users running a local proxy after the RFC 2544 check was added in 2026.2.22-2.

Furthermore, even though SsrFPolicy.allowRfc2544BenchmarkRange already existed and partial wiring was in web-fetch.ts, the ToolsWebFetchSchema Zod schema used .strict() without including ssrfPolicy — so the config field was silently rejected at validation time with:

Unrecognized key: "ssrfPolicy" at path tools.web.fetch

Additionally, readability and firecrawl sub-config were in the same situation: present in types.tools.ts and schema.help.ts but missing from ToolsWebFetchSchema, causing config validation failures.

Fixes #25215

Changes

  • src/config/zod-schema.agent-runtime.ts — Add ssrfPolicy, readability, and firecrawl to ToolsWebFetchSchema (all three caused unrecognized-key errors due to .strict())
  • src/agents/tools/web-fetch.ts — Wire ssrfPolicy.allowRfc2544BenchmarkRange through to fetchWithSsrFGuard
  • src/config/types.tools.ts — TypeScript type for the new config field
  • src/config/schema.help.ts — Help text for tools.web.fetch.ssrfPolicy and tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange
  • src/config/schema.labels.ts — UI labels for the new ssrfPolicy fields
  • src/agents/tools/web-fetch.ssrf.test.ts — Tests for RFC 2544 range allow/block behavior
  • src/config/config.schema-regressions.test.ts — Config regression tests for ssrfPolicy, readability, and firecrawl

Config

Users running Clash/mihomo in fake-ip mode can now add to their config:

{
  "tools": {
    "web": {
      "fetch": {
        "ssrfPolicy": {
          "allowRfc2544BenchmarkRange": true
        }
      }
    }
  }
}

When enabled, the 198.18.0.0/15 range is permitted for web_fetch; all other SSRF protections (private IPs, loopback, cloud-metadata hostnames, etc.) remain active.

Greptile Summary

Added ssrfPolicy.allowRfc2544BenchmarkRange config option to fix web_fetch compatibility with Clash/mihomo proxy fake-ip mode, and fixed schema validation bugs that were silently rejecting ssrfPolicy, readability, and firecrawl config fields.

Key changes:

  • Wired ssrfPolicy.allowRfc2544BenchmarkRange through from config to fetchWithSsrFGuard in web-fetch.ts:539
  • Fixed ToolsWebFetchSchema missing fields (readability, ssrfPolicy, firecrawl) that caused silent rejection with .strict() validation
  • Added comprehensive tests covering RFC 2544 range blocking and allowlist behavior
  • Added config regression tests for all three previously-broken fields

Confidence Score: 5/5

  • Safe to merge with no blocking issues found
  • The implementation correctly wires the new config option through all layers (schema, types, implementation), includes comprehensive tests for all three config fields (ssrfPolicy, readability, firecrawl), and fixes a real schema validation bug where .strict() was silently rejecting valid user config. The security change is conservative (defaults to blocking, requires explicit opt-in), and all SSRF protections remain active when enabled.
  • No files require special attention

Last reviewed commit: 41ab60b

…ption

web_fetch unconditionally applied the SSRF block list, which includes
the RFC 2544 benchmark range (198.18.0.0/15). Clash/mihomo and similar
proxy tools use this range for their fake-ip mode: DNS queries return
virtual IPs in 198.18.x.x that are transparently forwarded to the real
destination by the kernel. The block made web_fetch completely unusable
for these users after the RFC 2544 check was added in 2026.2.22-2.

The underlying SsrFPolicy.allowRfc2544BenchmarkRange option already
existed (used by the Telegram delivery path), and was partially wired
into the web_fetch tool. However, ToolsWebFetchSchema used .strict()
without including ssrfPolicy, so the config field was rejected at
validation time with 'Unrecognized key: ssrfPolicy'.

Fix:
- Add ssrfPolicy, readability, and firecrawl to ToolsWebFetchSchema
  (all three were present in types.tools.ts and schema.help.ts but
   missing from the Zod validation schema, causing config rejections)
- Wire ssrfPolicy.allowRfc2544BenchmarkRange through to fetchWithSsrFGuard
- Add schema help and labels for tools.web.fetch.ssrfPolicy
- Add config regression tests for ssrfPolicy, readability, and firecrawl

When tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange is true,
the 198.18.0.0/15 range is allowed; all other SSRF protections (private
IPs, loopback, cloud-metadata hostnames, etc.) remain active.

Fixes openclaw#25215
@fatoncn
Copy link

fatoncn commented Feb 26, 2026

This would fix #25215 for us — we run Clash/mihomo in fake-ip mode and had to pin an older version to work around the SSRF block. Clean approach exposing it as a config option. 👍

@lumenclaw-cloud
Copy link

This fix is critical for many users in China who rely on Clash/mihomo with fake-ip mode. The web_fetch tool is completely unusable without this. Hope this can be merged soon! Thanks for the clean implementation.

@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 3, 2026
@reallinzc
Copy link

This fix is critical for many users in China who rely on Clash/mihomo with fake-ip mode. The web_fetch tool is completely unusable without this. Hope this can be merged soon! Thanks for the clean implementation.

@openclaw-barnacle openclaw-barnacle bot removed the stale Marked as stale due to inactivity label Mar 4, 2026
@byungsker
Copy link
Contributor Author

Closing — issue #25215 is already being addressed by PR #26436. Deferring to avoid duplication.

@byungsker byungsker closed this Mar 7, 2026
@jiesou
Copy link

jiesou commented Mar 7, 2026

Closing — issue #25215 is already being addressed by PR #26436. Deferring to avoid duplication.

These are different. The current issue affects the web_fetch tool, while #26436 only affects the discord channel.

@boat2moon
Copy link

These are different. The current issue affects the web_fetch tool, while #26436 only affects the discord channel.

These are different. The current issue affects the web_fetch tool, while #26436 only affects the discord channel.

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: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web_fetch SSRF check blocks Clash/mihomo fake-ip range (198.18.0.0/15) — regression in 2026.2.22-2

6 participants