fix(web-fetch): respect NO_PROXY when useTrustedEnvProxy is enabled#94541
fix(web-fetch): respect NO_PROXY when useTrustedEnvProxy is enabled#94541cxbAsDev wants to merge 2 commits into
Conversation
When tools.web.fetch.useTrustedEnvProxy is true, NO_PROXY env var excludes were previously ignored because the request fell through to the strict SSRF pinned-DNS path which blocks private-network addresses. Add a trustedNoProxyBypass gate that relaxes SSRF private-network checks for NO_PROXY-matched hosts while keeping hostname allowlist and DNS pinning active. The NO_PROXY host is added to allowedHostnames and allowPrivateNetwork is set to true, scoped only to the matched target. Closes openclaw#93807 Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 26, 2026, 11:29 PM ET / 03:29 UTC. Summary PR surface: Source +30, Tests +148, Docs +3. Total +181 across 3 files. Reproducibility: yes. source-level: current main and v2026.6.10 skip EnvHttpProxyAgent when NO_PROXY matches, then use strict pinned-DNS SSRF checks that block private/local targets. I did not run a live proxy plus local-service reproduction in this read-only review. Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one canonical shared fetch-guard policy only after maintainer security approval and redacted live web_fetch proof, or preserve the shipped strict fallback if NO_PROXY should remain proxy-bypass-only. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main and v2026.6.10 skip EnvHttpProxyAgent when NO_PROXY matches, then use strict pinned-DNS SSRF checks that block private/local targets. I did not run a live proxy plus local-service reproduction in this read-only review. Is this the best way to solve the issue? Unclear until maintainers approve the security policy. If NO_PROXY local access is approved, the shared fetch-guard exact-host trust shape is cleaner than wrapper-only or full allowPrivateNetwork alternatives. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cee2aca40912. Label changesLabel justifications:
Evidence reviewedPR surface: Source +30, Tests +148, Docs +3. Total +181 across 3 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…a guard Replace allowPrivateNetwork with exact-host trust via allowedHostnames so NO_PROXY-matched private/local addresses (RFC1918, tailnet, localhost) are reachable directly, but metadata and link-local addresses (169.254.x.x, cloud metadata IPs) remain blocked by the resolved-address guard in resolvePinnedHostnameWithPolicy. - Remove allowPrivateNetwork: true from the NO_PROXY effective policy - Add metadata/link-local regression tests for NO_PROXY-matched hosts - Update web_fetch docs to describe exact-host trust behavior Refs openclaw#94541, openclaw#93807 Co-Authored-By: Claude <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Summary
When
tools.web.fetch.useTrustedEnvProxy: trueis set andNO_PROXYexcludes a target host,web_fetchshould bypass the proxy and connect directly. The proxy bypass logic inshouldUseEnvHttpProxyForUrl()already detects NO_PROXY matches, but after skipping proxy creation the request falls through to the strict SSRF pinned-DNS path which blocks private/internal IP addresses — making NO_PROXY exclusions ineffective for local services.Fix: use exact-host trust via
allowedHostnamesfor NO_PROXY-matched hosts. This allows private and local addresses (RFC1918, tailnet, localhost) to be reached directly without the proxy, while metadata and link-local addresses (169.254.x.x, cloud metadata IPs) remain blocked by the resolved-address guard inresolvePinnedHostnameWithPolicy. Does NOT setallowPrivateNetwork: truewhich would skip all SSRF checks.Fixes #93807.
Changes
src/infra/net/fetch-guard.ts: exact-host trust viaallowedHostnamesfor NO_PROXY hosts, preserving metadata/link-local guardsrc/infra/net/fetch-guard.ssrf.test.ts: +2 metadata/link-local regression tests for NO_PROXY-matched hostsdocs/tools/web-fetch.md: updated NO_PROXY behavior descriptionReal behavior proof (required for external PRs)
Behavior addressed:
web_fetchwithuseTrustedEnvProxy: trueignoresNO_PROXYexclusions for private-network targets. After fix, NO_PROXY-matched hosts use exact-host trust (private IPs allowed, metadata/link-local still blocked).Real environment tested: Linux, Node 24, OpenClaw PR branch 149e547
Exact steps or command run after fix:
Evidence after fix:
Includes 2 new metadata/link-local regression tests:
blocks link-local resolved addresses for NO_PROXY-matched hosts (metadata guard)— DNS rebinding to 169.254.169.254 is blockedblocks cloud metadata resolved addresses for NO_PROXY-matched hosts (metadata guard)— DNS rebinding to 100.100.100.200 is blockedPrivate IPs (192.168.x.x) and localhost are allowed for NO_PROXY-matched hosts, proving exact-host trust works.
Observed result after fix: NO_PROXY-matched hosts can reach private networks directly. Metadata/link-local IPs remain blocked. The
allowPrivateNetwork: trueflag is NOT used — exact-host trust viaallowedHostnamespreserves the resolved-address guard.What was not tested: A live web_fetch call against a real private NO_PROXY target was not tested — requires a production proxy setup.
Tests and validation
fetch-guard.ssrf.test.ts: 90/90 passed ✅ (incl. 2 metadata guard tests)web-fetch.mdupdatedRisk checklist
Did user-visible behavior change?
Yes— NO_PROXY hosts can now reach private IPs directly.Did config, environment, or migration behavior change?
No.Did security, auth, secrets, network, or tool execution behavior change?
Yes— SSRF security boundary: exact-host trust replaces fullallowPrivateNetwork, preserving metadata/link-local blocking.