Skip to content

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

Closed as not planned

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.

Activity

  1. clawsweeper commented on Apr 26, 2026

    @clawsweeper
    Contributor

    Closing this as duplicate or superseded after Codex automated review.

    Issue #63565 reports a real remaining proxy-only web_fetch gap on current main, but the remaining work is already tracked by the active canonical PR #58034. Current main still keeps built-in web_fetch and 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_fetch and Firecrawl fallback paths.

    What I checked:

    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.

  2. locked as resolved and limited conversation to collaborators on Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions