Skip to content

web_fetch tool bypasses env proxy in proxy-only environments (SSRF guard DNS pinning) #63565

@mjamiv

Description

@mjamiv

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=1 all 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

Confirmed on v2026.4.9, Linux x64, systemd gateway, OpenShell v0.0.25 sandbox with HTTP CONNECT proxy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions