Repository navigation
fix(resilience): include RFC1918, CGNAT, and mDNS hosts in isLocalProvider (#11091) - #11122
Conversation
9a483c5 to
c26f886
Compare
|
Heads-up on overlap: #11093 has been open against One behavioral difference worth carrying into whichever PR lands:
On diff scope: this PR currently carries ~2,180 lines across 55 files — Happy either way — @diegosouzapw, whichever you prefer to take. |
c26f886 to
762611b
Compare
762611b to
35a4510
Compare
|
Thank you @yourspraveen for the review! Updated this PR with |
35a4510 to
a91f6e9
Compare
cd7cf23 to
8237d4f
Compare
4220c81
into
cheaper-inference:release/v3.8.50
…nference#11122) Includes changelog fragment for cheaper-inference#11154.
…11154) Validated on a worktree over the current tip: the red it fixes reproduced exactly as described (media-page-client-browser-bundle red since #11122 — providerRegistry became reachable from the dashboard client bundle via node:net). Post-fix: bundle test 2/2 green, new ip-parity suite + is-local-provider 7/7, all 7 outboundUrlGuard consumer suites 76/76 (the moved normalizeHost/isPrivateHost keep their re-exports; routing behavior untouched). Thank you @yourspraveen — clean surgical extraction with a pure-JS ipVersion mirroring Node's own regexes.
…vider (cheaper-inference#11091) (cheaper-inference#11122) Cherry-picked both value commits (a1fa49a8 + a91f6e93, incl. the fail-open guard for unparseable hostnames) onto the current tip, dropping the stale base-red sync commits. Focused tests: is-local-provider-11091 + the isLocalProvider consumer suites (provider-validation-specialty, ollama-local-provider) 127/127; mutation coverage no-drift. Fixes cheaper-inference#11091 — RFC1918/CGNAT/link-local/mDNS hosts now classify as local via the existing isPrivateHost. Thank you @rqzbeh!
…nference#11122) (cheaper-inference#11154) Validated on a worktree over the current tip: the red it fixes reproduced exactly as described (media-page-client-browser-bundle red since cheaper-inference#11122 — providerRegistry became reachable from the dashboard client bundle via node:net). Post-fix: bundle test 2/2 green, new ip-parity suite + is-local-provider 7/7, all 7 outboundUrlGuard consumer suites 76/76 (the moved normalizeHost/isPrivateHost keep their re-exports; routing behavior untouched). Thank you @yourspraveen — clean surgical extraction with a pure-JS ipVersion mirroring Node's own regexes.
Fixes #11091.
Root Cause
isLocalProvider(baseUrl)inopen-sse/config/providerRegistry.tsmatched onlylocalhost,127.0.0.1,172.16.0.0/12, andLOCAL_HOSTNAMES. It missed192.168.0.0/16,10.0.0.0/8,100.64.0.0/10(Tailscale/CGNAT),169.254.0.0/16, and.local/.internalhostnames. As a result, 404 responses from self-hosted LAN/Tailscale LLMs misclassified the host as non-local and triggered a whole-connection cooldown instead of a model-only lockout.Fix
Updated
isLocalProvider(baseUrl)to delegate hostname evaluation toisPrivateHost(hostname)from@/shared/network/outboundUrlGuard, which already covers all RFC1918, CGNAT/Tailscale, link-local, and mDNS private domain suffixes.Test Coverage
Added unit test
tests/unit/is-local-provider-11091.test.tsasserting that LAN (192.168.1.50,10.0.0.5), Tailscale (100.64.1.2), link-local (169.254.1.1), mDNS (studio.local,mybox.internal), and Docker (172.18.0.2) hosts resolve totrue, while public hosts (api.openai.com,8.8.8.8) resolve tofalse.