feat(web-fetch): add ssrfPolicy.allowRfc2544BenchmarkRange config option#51407
feat(web-fetch): add ssrfPolicy.allowRfc2544BenchmarkRange config option#51407xing-xing-coder wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds a new Key changes:
One gap to address: The new config paths ( Confidence Score: 4/5Safe to merge; the only gap is missing documentation metadata that does not affect runtime behavior. The implementation is correct — policy propagation, cache-key encoding (now using JSON.stringify), and schema validation are all properly handled. The previous cache-key concern has been resolved. The remaining issue is the absence of label/help/tags entries in schema.labels.ts, schema.help.ts, and schema.base.generated.ts, which means the new config options are invisible in the generated config docs. That's a real gap worth fixing before merge, but it's not a runtime bug or security concern. src/config/schema.base.generated.ts, src/config/schema.labels.ts, src/config/schema.help.ts — all three are missing documentation entries for the new ssrfPolicy config paths.
|
| Filename | Overview |
|---|---|
| src/agents/tools/web-fetch.ts | Adds ssrfPolicy to WebFetchRuntimeParams, builds the SsrFPolicy object from config, passes it to fetchWithWebToolsNetworkGuard, and includes the full policy JSON in the cache key via JSON.stringify to prevent cross-policy cache bypass. Implementation is correct. |
| src/config/zod-schema.agent-runtime.ts | Adds ssrfPolicy with allowRfc2544BenchmarkRange as a strict optional object in ToolsWebFetchSchema. Correct use of .strict() prevents unknown fields. |
| src/config/types.tools.ts | Adds TypeScript type and JSDoc for ssrfPolicy on the ToolsConfig fetch config. Well documented. |
| src/config/schema.base.generated.ts | Adds ssrfPolicy to the JSON schema definition but omits the corresponding uiHints entries (label, help, tags) that every other tools.web.fetch.* key has. |
| docs/.generated/config-baseline.json | Generated file correctly reflects schema additions but is missing label, help, and tags for the two new ssrfPolicy paths due to absent uiHints registration. |
| docs/.generated/config-baseline.jsonl | Same documentation metadata gap as config-baseline.json — new ssrfPolicy entries lack label, help, and tags fields. |
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/config/schema.base.generated.ts
Line: 12989-12993
Comment:
**Missing uiHints entries for the new ssrfPolicy config paths**
`schema.base.generated.ts` contains a `uiHints` map that provides `label`, `help`, and `tags` for every known config path. The new `tools.web.fetch.ssrfPolicy` and `tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange` paths have no entries in that map, which is why the generated `config-baseline.json` / `config-baseline.jsonl` are missing `label`, `help`, and `tags` for both fields.
`schema.labels.ts` (line 234) and `schema.help.ts` (line 691) are also missing corresponding entries — compare with the existing `browser.ssrfPolicy` family (labels at line 519, help at line 283).
The fix requires additions in all three source files, mirroring what already exists for `browser.ssrfPolicy`:
```ts
// schema.base.generated.ts — insert after "tools.web.fetch.readability" block
"tools.web.fetch.ssrfPolicy": {
label: "Web Fetch SSRF Policy",
help: "Server-side request forgery guardrail overrides for web_fetch. Only open specific exemptions for known-safe network topologies (e.g. fake-IP proxy).",
tags: ["access", "security", "tools"],
},
"tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange": {
label: "Allow RFC 2544 Benchmark Range",
help: "Allow web_fetch to reach IPs in the RFC 2544 benchmark range (198.18.0.0/15). Enable only when an in-process fake-IP proxy (Clash TUN, Surge, Mihomo) occupies that range.",
tags: ["access", "security", "tools"],
},
```
```ts
// schema.labels.ts — insert after "tools.web.fetch.readability"
"tools.web.fetch.ssrfPolicy": "Web Fetch SSRF Policy",
"tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange": "Allow RFC 2544 Benchmark Range",
```
```ts
// schema.help.ts — insert after "tools.web.fetch.readability"
"tools.web.fetch.ssrfPolicy":
"Server-side request forgery guardrail overrides for web_fetch.",
"tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange":
"Allow web_fetch to reach IPs in the RFC 2544 benchmark range (198.18.0.0/15). Enable only when a fake-IP proxy occupies that range.",
```
After making those edits, re-run `pnpm config:docs:gen` to regenerate the baseline files with proper labels, help text, and `access`/`security`/`tools` tags.
How can I resolve this? If you propose a fix, please make it concise.Reviews (2): Last reviewed commit: "fix: merge upstream/main and regenerate ..." | Re-trigger Greptile
✅ Issues Fixed1. Trailing whitespaceRemoved all trailing whitespace in modified files. 2. Cache key design (improved)Before: Hardcoded suffix for a single flag ( After: Uses const ssrfPolicySuffix = params.ssrfPolicy
? `:${JSON.stringify(params.ssrfPolicy)}`
: "";This ensures that any future additions to 3. CI FailuresThe remaining CI failures appear unrelated to this PR. They consistently originate from the Telegram extension ( From the logs, this looks like a single shared failure across multiple test jobs rather than multiple independent issues. Summary: All review feedback has been addressed. The changes are scoped, backward-compatible (opt-in), and safe to merge. |
8243c17 to
a127fc6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db187e7325
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf0586dc80
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2895e163f
ℹ️ 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".
SummaryThis PR adds an opt-in Why this mattersIn TUN/enhanced mode, proxy tools (Clash, Clash Verge, Mihomo, Surge) intercept DNS queries and return virtual IPs in the 198.18.x.x range. This makes This issue has been reported 10+ times across multiple issues, showing strong community demand:
Changes
Verification
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@greptileai please re-review this PR |
af2557a to
11a8e63
Compare
|
hope this could be merge |
f984319 to
6dd221a
Compare
|
Hi @vincentkoc, this PR adds a It's been open for 11 days with 6 linked issues (#25322, #27597, #48080, #48961, #49377, #49444). The change is minimal — just a config option pass-through. CI is green (Windows failures are pre-existing flaky SQLite tests). Could you take a look when you have a chance? Thanks! |
|
Picked this up and filled the remaining gaps on top of the branch. Follow-up commits:
What changed:
Verification:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3930a5578
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ssrfPolicy: { | ||
| type: "object", | ||
| properties: { | ||
| allowRfc2544BenchmarkRange: { | ||
| type: "boolean", |
There was a problem hiding this comment.
Regenerate base uiHints for new web_fetch SSRF config
This change adds tools.web.fetch.ssrfPolicy to the generated JSON schema object, but the generated uiHints payload in src/config/schema.base.generated.ts was not updated for these new paths, so runtime schema consumers miss label/help/tag metadata for the setting. Fresh evidence: pnpm test -- src/config/schema.base.generated.test.ts now fails because computeBaseConfigSchemaResponse() includes tools.web.fetch.ssrfPolicy* hints while GENERATED_BASE_CONFIG_SCHEMA does not, which breaks the generated-schema consistency gate.
Useful? React with 👍 / 👎.
Add a scoped ssrfPolicy config block to web_fetch, allowing users behind fake-IP proxy tools (Clash TUN, Surge, etc.) to enable RFC 2544 benchmark range access. Changes: - src/config/zod-schema.agent-runtime.ts: add ssrfPolicy to ToolsWebFetchSchema - src/config/types.tools.ts: add TypeScript type and JSDoc for ssrfPolicy - src/config/schema.base.generated.ts: add ssrfPolicy schema entry - src/agents/tools/web-fetch.ts: pass policy to fetchWithWebToolsNetworkGuard and include ssrfPolicy in cache key - docs/.generated/config-baseline.*: regenerate baselines Closes openclaw#25322, openclaw#27597, openclaw#48080, openclaw#48961, openclaw#49377, openclaw#49444
2316ddb to
297e96e
Compare
|
Hi @vincentkoc — I think the current CI failure is likely due to It also looks like the branch now needs an update against current Since you already picked this up, I didn’t want to push additional changes on top of your follow-up commits. Thanks again. |
Summary
This PR adds a scoped
ssrfPolicyconfig block toweb_fetch, allowing users behind fake-IP proxy tools (Clash TUN, Surge, etc.) to enable RFC 2544 benchmark range access.Problem
OpenClaw's SSRF guard blocks RFC 2544 benchmark range (198.18.0.0/15), which is used by fake-IP proxy tools like Clash, Surge, and Mihomo. This causes
web_fetchto fail for users behind these proxies.Solution
Add a configuration option:
{ "tools": { "web": { "fetch": { "ssrfPolicy": { "allowRfc2544BenchmarkRange": true } } } } }Changes
src/config/zod-schema.agent-runtime.ts: addssrfPolicytoToolsWebFetchSchemasrc/config/types.tools.ts: add TypeScript type and JSDoc forssrfPolicysrc/agents/tools/web-fetch.ts:ssrfPolicytoWebFetchRuntimeParamspolicytofetchWithWebToolsNetworkGuardssrfPolicyin cache key to prevent cross-policy cache bypassRelated Issues
Closes #25322, #27597, #48080, #48961, #49377, #49444