fix: prefer IPv4 for pinned SSRF lookups#80162
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. source-level reproduction is high confidence: the linked report gives concrete WSL2/no-IPv6-route steps, current main can rotate automatic pinned lookups from IPv4 to IPv6, and Real behavior proof Next step before merge Security Review detailsBest possible solution: Merge the focused network fix after maintainer review if the IPv4-preferred automatic lookup policy is accepted, keeping DNS-answer validation before candidate selection and the new regression coverage in place. Do we have a high-confidence way to reproduce the issue? Yes, source-level reproduction is high confidence: the linked report gives concrete WSL2/no-IPv6-route steps, current main can rotate automatic pinned lookups from IPv4 to IPv6, and Is this the best way to solve the issue? Yes, from source review this is the narrowest maintainable fix for the reported dual-stack trigger: keep automatic pinned lookups on IPv4 when IPv4 exists, preserve explicit IPv6 lookup behavior, and classify the observed network error like adjacent unreachable-network errors. The remaining question is maintainer policy acceptance, not a repairable code defect. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 09132effa82a. Re-review progress:
|
14d6e93 to
8080627
Compare
8080627 to
89b3fac
Compare
Summary
EADDRNOTAVAILas transient and benign for uncaught network exception handling, matching the existingENETUNREACHtreatment.EADDRNOTAVAILclassification.Real behavior proof
127.0.0.1and OpenClaw's production pinned lookup helper loaded throughtsx.pnpm exec tsx -e '<script>'that starts a real IPv4-only HTTP server, creates a pinned dual-stack lookup fordualstack.openclaw.testwith127.0.0.1plus2607:6bc0::10, performs two real HTTP requests through the default lookup path, then asks for explicit family 6.{ "first": "200:ok", "second": "200:ok", "explicitV6": { "address": "2607:6bc0::10", "family": 6 } }Verification
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-vitest-cache-80078 pnpm test src/infra/net/ssrf.pinning.test.ts src/infra/net/ssrf.dispatcher.test.ts src/infra/unhandled-rejections.test.ts src/agents/provider-transport-fetch.test.tspnpm check:changedpnpm exec oxfmt --check --threads=1 src/infra/net/ssrf.ts src/infra/net/ssrf.pinning.test.ts src/infra/unhandled-rejections.ts src/infra/unhandled-rejections.test.ts CHANGELOG.mdgit diff --check