SIGN IN SIGN UP
koala73 / worldmonitor UNCLAIMED

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

0 0 157 TypeScript

fix(sidecar): block private targets in global fetch (#3608)

* fix(sidecar): block private targets in global fetch

* fix(sidecar): keep private probes on IPv4 fetch path

* fix(sidecar): block non-global fetch ranges

* fix(sidecar): close TOCTOU v6 gap, surface SSRF on cloud fallback, restore distinct-upstream tests

Review follow-ups on the global-fetch SSRF override (#3608):

1. Pin first IPv6 when no IPv4 available. firstIPv4Address used to leave
   IPv6-only public hostnames with no pinned lookup while still forcing
   family:4, so the OS re-resolved under v4 and a hostile resolver could
   land the connection on a private v4. Introduce pickPinnedAddress
   (v4-first, v6 fallback) and pass the pinned family to both lookup and
   http(s).request.

2. Make a misconfigured private remoteBase actionable.
   - resolveConfig now warns at startup when cloudFallback is on and
     remoteBase parses to a private/loopback host without
     allowPrivateRemoteBase=true.
   - tryCloudFallback recognises ERR_SSRF_BLOCKED and logs the redacted
     URL plus the remediation, instead of a vague "cloud fallback failed".

3. Restore distinct-upstream coverage. The two body-preservation tests
   had been rewritten to loop back through the sidecar itself because the
   previous random-port upstream was now blocked. Add an
   allowPrivateFetchOrigins option (programmatic only, mirrors
   allowPrivateRemoteBase) and reintroduce a separate upstream server in
   both tests, re-asserting receivedBody and upstreamHits.

Validation
- node --test src-tauri/sidecar/local-api-server.test.mjs - 41/41 pass
- npm run test:sidecar - 98/98 pass
- npm run typecheck
- npm run typecheck:api
- npx biome lint src-tauri/sidecar/local-api-server.mjs src-tauri/sidecar/local-api-server.test.mjs - only pre-existing complexity/HTML-escape warnings

---------

Co-authored-by: Elie Habib <elie.habib@gmail.com>
L
Lucas Passos committed
a1ac134b493adb446609a03a09fece345f82fb62
Parent: 01f925b
Committed by GitHub <noreply@github.com> on 5/26/2026, 6:38:12 AM