Repository navigation
Description
Summary
The web_fetch tool and Firecrawl web_fetch provider fail in proxy-only environments (e.g., OpenShell sandboxes) because their code paths don't pass useEnvProxy: true to the SSRF guard, causing DNS pinning to run before the proxy is used.
web_search works correctly because it uses withTrustedWebToolsEndpoint (which passes useEnvProxy: true). web_fetch uses different code paths that don't.
Environment
- OpenClaw v2026.4.9
- Running inside an OpenShell sandbox with HTTP CONNECT proxy (no direct DNS)
HTTPS_PROXY,HTTP_PROXY,NODE_USE_ENV_PROXY=1all set
Affected Code Paths
1. Built-in runWebFetch (pi-embedded-*.js)
// ~line 16154 — calls fetchWithWebToolsNetworkGuard WITHOUT useEnvProxy
const result = await fetchWithWebToolsNetworkGuard({
url: params.url,
maxRedirects: params.maxRedirects,
timeoutSeconds: params.timeoutSeconds,
lookupFn: params.lookupFn,
// missing: useEnvProxy: true
init: { headers: { ... } }
});2. Firecrawl client (firecrawl-client-*.js)
Uses withStrictWebToolsEndpoint which calls withWebToolsNetworkGuard without useEnvProxy: true:
// web-shared-*.js
async function withStrictWebToolsEndpoint(params, run) {
return await withWebToolsNetworkGuard(params, run);
// missing: { ...params, useEnvProxy: true }
}Working path (for comparison)
web_search uses withTrustedWebToolsEndpoint:
async function withTrustedWebToolsEndpoint(params, run) {
return await withWebToolsNetworkGuard({
...params,
policy: WEB_TOOLS_TRUSTED_NETWORK_SSRF_POLICY,
useEnvProxy: true // ← this is what web_fetch is missing
}, run);
}Error
[tools] web_fetch failed: getaddrinfo EAI_AGAIN example.com
The SSRF guard tries to resolve the target hostname via DNS before checking the proxy, which fails in environments where all DNS must go through the proxy.
v4.9 Partial Fix
v4.9 improved fetch-guard so that TRUSTED_ENV_PROXY mode skips DNS pinning for the target URL (the env proxy check now runs before resolvePinnedHostnameWithPolicy). However, the callers listed above don't set useEnvProxy: true, so the TRUSTED_ENV_PROXY mode is never activated for web_fetch.
Fix
Add useEnvProxy: true to the fetchWithWebToolsNetworkGuard call in runWebFetch, and pass it through in withStrictWebToolsEndpoint. This is a 2-line change.
Related
- globalThis.fetch (undici) does not honor HTTP_PROXY/HTTPS_PROXY env vars #62181 —
globalThis.fetchignores proxy env vars (same root cause class) - fix(gateway): ensure undici env proxy dispatcher after startup #63490 — Ensure undici env proxy dispatcher at startup
- PR fix(slack): strip dispatcher option before passing to globalThis.fetch #63401 — Strip dispatcher from Slack fetch
Confirmed on v2026.4.9, Linux x64, systemd gateway, OpenShell v0.0.25 sandbox with HTTP CONNECT proxy.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Apr 26, 2026
Closing this as duplicate or superseded after Codex automated review.
Issue #63565 reports a real remaining proxy-only
web_fetchgap on currentmain, but the remaining work is already tracked by the active canonical PR #58034. Currentmainstill keeps built-inweb_fetchand Firecrawl on strict DNS-pinned fetch paths, while #58034 is the active implementation/review thread for the explicit trusted-env-proxy opt-in, NO_PROXY fallback, docs, and tests.Best possible solution:
Close #63565 as superseded by the active canonical PR #58034 and keep the remaining maintainer review, implementation, docs, and regression-test work concentrated there. The eventual fix should preserve the explicit opt-in boundary for trusted env proxy use and cover both built-in
web_fetchand Firecrawl fallback paths.What I checked:
runWebFetchcallsfetchWithWebToolsNetworkGuardwithout passinguseEnvProxy, so built-inweb_fetchdoes not opt into trusted env proxy mode on current main. (src/agents/tools/web-fetch.ts:416, 921ffad7c7a6)withStrictWebToolsEndpoint, and that helper delegates unchanged towithWebToolsNetworkGuardrather than settinguseEnvProxy: true. (extensions/firecrawl/src/firecrawl-client.ts:94, 921ffad7c7a6)withTrustedWebToolsEndpointsetsuseEnvProxy: true, whilewithStrictWebToolsEndpointdoes not; the existing test asserts strict endpoint mode remainsGUARDED_FETCH_MODE.STRICT. (src/agents/tools/web-guarded-fetch.ts:64, 921ffad7c7a6)EnvHttpProxyAgentonly inTRUSTED_ENV_PROXYmode whenshouldUseEnvHttpProxyForUrlapplies; otherwise it resolves and pins the target hostname. (src/infra/net/fetch-guard.ts:357, 921ffad7c7a6)web_fetcheven whenHTTP_PROXYis configured, and separately cover env-proxy routing only when trusted proxy mode is explicitly enabled. (src/agents/tools/web-tools.fetch.test.ts:257, 921ffad7c7a6)So I’m closing this here and keeping the remaining discussion on the canonical linked item.
Codex Review notes: model gpt-5.5, reasoning high; reviewed against 921ffad7c7a6.