Repository navigation
Description
Summary
fetchWithSsrFGuard still performs local DNS pinning for STRICT fetches when OpenClaw's managed proxy lifecycle is active. In proxy-only sandboxes, local DNS can fail or disagree with the managed proxy resolver, so strict/default guarded fetches fail before the proxy can resolve the target and enforce its egress policy.
This is showing up as repeated downstream patches in NemoClaw/OpenShell integrations. The common shape is not one plugin-specific bug: many OpenClaw call paths either call withStrictGuardedFetchMode(...) directly or omit mode, which defaults to STRICT.
Current behavior
resolveGuardedFetchMode() defaults missing mode to STRICT.
In STRICT mode, fetchWithSsrFGuard() currently does this even when OPENCLAW_PROXY_ACTIVE=1 and proxy env vars are configured:
- Call
resolvePinnedHostnameWithPolicy(...). - That helper uses local
dns.lookup(..., { all: true }). - Only after local DNS succeeds does the fetch use the env proxy dispatcher.
That means proxy-only environments can fail with local DNS errors such as EAI_AGAIN / ENOTFOUND, or can reject fake/sentinel DNS results, before the managed proxy has a chance to resolve and apply policy.
Affected call paths observed downstream
Examples in current OpenClaw source:
src/cron/isolated-agent/model-preflight.runtime.ts:probeLocalProviderEndpoint()callsfetchWithSsrFGuard()for managed inference preflight with a policy but nomode, so it defaults toSTRICT.extensions/googlechat/src/auth.ts:fetchChatCerts()fetches Google Chat JWT verification certs with nomodeor policy.extensions/googlechat/src/api.ts:withGoogleChatResponse()is used by outbound sends, edits, uploads, media fetches, and reactions; it passes nomodeor policy.extensions/mattermost/src/mattermost/client.ts: the Mattermost guarded client wrapper passes a policy but nomode.extensions/mattermost/src/mattermost/probe.ts: the Mattermost reachability probe passes a policy but nomode.src/media/fetch.ts: media fetch can explicitly choosewithStrictGuardedFetchMode(...).src/agents/tools/web-guarded-fetch.ts: web tools explicitly choose strict mode unlessuseEnvProxyis enabled.
Downstream references
NemoClaw has had to patch or work around this repeatedly:
- @openclaw/googlechat cert fetch fails: SSRF guard's per-request dispatcher bypasses NemoClaw's nemoclaw-http-proxy-fix.js global-agent hook NVIDIA/NemoClaw#4687: Google Chat cert fetch fails because strict guarded fetch bypasses the sandbox proxy path.
- fix(sandbox): cron preflight inference.local uses trusted env-proxy mode NVIDIA/NemoClaw#5129: cron preflight for
inference.localhad to injectmode: "trusted_env_proxy". - feat(messaging): onboard Mattermost for OpenClaw NVIDIA/NemoClaw#5592: Mattermost onboarding exposes more strict-by-default call paths.
- feat(messaging): add Google Chat channel for OpenClaw NVIDIA/NemoClaw#6120: Google Chat channel adds a preload rewrite so inbound cert verification and outbound Google Chat calls use trusted proxy modes.
Related OpenClaw issue history shows the same class in individual call paths:
- web_fetch tool bypasses env proxy in proxy-only environments (SSRF guard DNS pinning) #63565:
web_fetchbypasses env proxy in proxy-only environments due to SSRF guard DNS pinning. - [Bug]: memory_search remote embeddings fail with ENOTFOUND when env proxy is configured — withRemoteHttpResponse skips TRUSTED_ENV_PROXY mode #52162: memory search remote embeddings fail with
ENOTFOUNDbecause a call path skipsTRUSTED_ENV_PROXY. - google-gemini-cli-auth: OAuth token exchange fails behind proxy (fetchWithSsrFGuard uses createPinnedDispatcher instead of EnvHttpProxyAgent) #34401: Google OAuth token exchange fails behind proxy because guarded fetch uses pinned direct dispatch instead of env proxy dispatch.
Expected behavior
When OpenClaw's managed proxy lifecycle is active (OPENCLAW_PROXY_ACTIVE=1) and the env HTTP proxy applies to the target URL, STRICT fetches should keep the pre-DNS SSRF checks that do not require local resolution:
- URL parsing and scheme checks
- hostname allowlist checks
- blocked hostname checks
- IP literal/private/internal/special-use checks
- redirect revalidation
Then the request should use the managed env proxy dispatcher without local DNS pinning. The managed proxy should own DNS resolution and private-IP enforcement for the final target in this mode.
This matches the trust boundary already implied by the managed proxy lifecycle and avoids requiring every plugin/call path to remember to opt into TRUSTED_ENV_PROXY.
Security notes
The fix should not make ordinary STRICT mode proxy-aware just because HTTP_PROXY is present. It should be limited to the managed proxy lifecycle signal. It should also preserve direct-mode DNS pinning outside managed proxy mode.
Tests should prove:
- default strict mode still ignores env proxy and pins local DNS
- strict mode with
OPENCLAW_PROXY_ACTIVE=1and env proxy configured uses the env proxy without local lookup - blocked hostnames and private IP literals are still rejected before fetch
- redirects still re-run the pre-DNS policy checks
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jul 2, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 2, 2026, 1:24 AM ET / 05:24 UTC.
Summary
Keep open: current main and v2026.6.11 still resolve target DNS in the strict managed-proxy branch before creating the env proxy dispatcher, so the reported proxy-only failure remains valid and security-sensitive.
Reproducibility: yes. from source, not from a live run: with
OPENCLAW_PROXY_ACTIVE=1, proxy env configured, and strict/default mode, current main callsresolvePinnedHostnameWithPolicy()before the env proxy dispatcher. A focused regression can use a failinglookupFnto prove the proxy is never reached.Root-cause cluster
Relationship:
canonicalCanonical: #98925
Summary: This issue is the central open report for strict/default guarded fetches doing local DNS before active managed-proxy dispatch; older related items fixed narrower caller or trusted-proxy paths.
Members:
partial_overlap: fix(net): skip DNS pinning before trusted env proxy dispatch #59007 - Merged PR fixed DNS-before-proxy ordering for explicitTRUSTED_ENV_PROXY, but did not cover strict/default mode underOPENCLAW_PROXY_ACTIVE.same_root_cause: web_fetch tool bypasses env proxy in proxy-only environments (SSRF guard DNS pinning) #63565 - Closed web_fetch report describes strict DNS pinning before proxy in proxy-only environments, but at the web_fetch caller layer.same_root_cause: [Bug]: memory_search remote embeddings fail with ENOTFOUND when env proxy is configured — withRemoteHttpResponse skips TRUSTED_ENV_PROXY mode #52162 - Closed memory embeddings report describes default strict guarded fetch causing ENOTFOUND before proxy dispatch.adjacent_distinct: web_fetch useTrustedEnvProxy ignores NO_PROXY env variable #93807 - Open issue concernsNO_PROXYsemantics for web_fetch trusted-env-proxy mode, which is adjacent proxy/SSRF policy but not the same strict managed-proxy DNS ordering problem.partial_overlap: Refactor HTTP egress around external proxy enforcement #91722 - Open draft PR broadly replaces the HTTP egress boundary and could subsume this class, but it is not a narrow or safe canonical fix for this issue.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
Manual maintainer/security review is needed before implementation because the repair changes the core SSRF and managed-proxy trust boundary.
Security
Needs attention: The issue is security-sensitive because any fix changes how strict SSRF validation, DNS pinning, and managed proxy enforcement share responsibility.
Review details
Best possible solution:
Update the shared guarded-fetch managed-proxy branch so strict/default traffic that should use the active proxy performs pre-DNS hostname/IP-literal checks and then dispatches through the proxy, while preserving direct strict DNS pinning, loopback bypass rules, redirect revalidation, and focused regression coverage.
Do we have a high-confidence way to reproduce the issue?
Yes from source, not from a live run: with
OPENCLAW_PROXY_ACTIVE=1, proxy env configured, and strict/default mode, current main callsresolvePinnedHostnameWithPolicy()before the env proxy dispatcher. A focused regression can use a failinglookupFnto prove the proxy is never reached.Is this the best way to solve the issue?
Unclear until maintainer/security review: the shared fetch guard is the right layer because many callers default to strict mode, but maintainers need to accept the managed proxy as the final DNS/IP enforcement boundary for this branch.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against c8dba85b5d41.
Label changes
Label justifications:
P1: The issue affects core guarded network fetches across managed-proxy deployments and can break real channel/provider workflows in proxy-only sandboxes.impact:security: The report is about the SSRF guard DNS-pinning boundary versus managed proxy DNS and private-IP enforcement.impact:message-loss: The listed Google Chat and Mattermost paths include outbound sends, uploads, reactions, and cert/API requests that can fail before reaching the proxy.maturity:stable: The affected managed-proxy guarded-fetch path belongs to the M4 Stable Gateway runtime network/security-control surface.Evidence reviewed
Security concerns:
src/infra/net/fetch-guard.ts:505The desired fix should skip local target DNS only when the OpenClaw-managed proxy lifecycle is active and the proxy applies, while preserving direct strict mode DNS pinning plus hostname, IP-literal, blocked-hostname, and redirect checks before dispatch.
Confidence: 0.9
Acceptance criteria:
OPENCLAW_PROXY_ACTIVE=1and an applicable HTTP(S) proxy does not call targetlookupFnbefore dispatch.What I checked:
canUseManagedProxyis true forSTRICTmode withOPENCLAW_PROXY_ACTIVE=1and proxy env configured, but that branch callsresolvePinnedHostnameWithPolicy()before selectingcreateHttp1EnvHttpProxyAgent(). (src/infra/net/fetch-guard.ts:505, c8dba85b5d41)resolveGuardedFetchMode()returnsGUARDED_FETCH_MODE.STRICTwhen callers omitmode, matching the issue's default-strict caller concern. (src/infra/net/fetch-guard.ts:147, c8dba85b5d41)resolvePinnedHostnameWithPolicy()useslookupFn ?? dnsLookupwith{ all: true }and checks resolved addresses before returning pinned addresses. (src/infra/net/ssrf.ts:541, c8dba85b5d41)lookupFnand does not assert that lookup is not called. (src/infra/net/fetch-guard.ssrf.test.ts:1409, c8dba85b5d41)fetchWithSsrFGuard()without settingmode, so they inherit strict behavior. (extensions/googlechat/src/api.ts:47, c8dba85b5d41)docs/security/network-proxy.md. (docs/security/network-proxy.md:15, c8dba85b5d41)Likely related people:
src/infra/net/proxy/proxy-lifecycle.ts,src/infra/net/proxy/active-proxy-state.ts,src/infra/net/fetch-guard.ts)src/infra/net/fetch-guard.ts,src/infra/net/proxy-env.ts,docs/security/network-proxy.md)src/infra/net/fetch-guard.ts,src/infra/net/ssrf.ts,src/infra/net/fetch-guard.ssrf.test.ts)src/infra/net/fetch-guard.ts,src/infra/net/proxy-env.ts,src/media-understanding/shared.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.