-
-
Notifications
You must be signed in to change notification settings - Fork 82.1k
fetchWithSsrFGuard strict mode resolves DNS locally before managed proxy #98925
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.Broken existing behavior primarily owned by an M4/M5 scorecard surface.
Description
Activity
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.Broken existing behavior primarily owned by an M4/M5 scorecard surface.
Type
Fields
Priority
None yet
Summary
fetchWithSsrFGuardstill performs local DNS pinning forSTRICTfetches 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 omitmode, which defaults toSTRICT.Current behavior
resolveGuardedFetchMode()defaults missingmodetoSTRICT.In
STRICTmode,fetchWithSsrFGuard()currently does this even whenOPENCLAW_PROXY_ACTIVE=1and proxy env vars are configured:resolvePinnedHostnameWithPolicy(...).dns.lookup(..., { all: true }).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:
inference.localhad to injectmode: "trusted_env_proxy".Related OpenClaw issue history shows the same class in individual call paths:
web_fetchbypasses env proxy in proxy-only environments due to SSRF guard DNS pinning.ENOTFOUNDbecause a call path skipsTRUSTED_ENV_PROXY.Expected behavior
When OpenClaw's managed proxy lifecycle is active (
OPENCLAW_PROXY_ACTIVE=1) and the env HTTP proxy applies to the target URL,STRICTfetches should keep the pre-DNS SSRF checks that do not require local resolution: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
STRICTmode proxy-aware just becauseHTTP_PROXYis 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:
OPENCLAW_PROXY_ACTIVE=1and env proxy configured uses the env proxy without local lookup