Uh oh!
There was an error while loading. Please reload this page.
fix(providers): pin Azure OpenAI/Anthropic endpoints to validated IP - #5060
Merged
Conversation
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
request.azureEndpointwithvalidateUrlWithDNSbut then discarded the resolved IP and handed the raw hostname to the SDK/fetch, which re-resolved DNS at connect time — letting a short-TTL rebinding host pass validation (public IP) then connect to an internal IP (e.g.169.254.169.254).createPinnedFetch(resolvedIP)ininput-validation.server.ts: a standardfetchrouted through an undiciAgentwith a pinned DNS lookup, so the connection goes to the validated IP while the hostname is preserved for TLS SNI / Host header. Because the lookup always returns the validated IP, redirect hops can't rebind to an internal address either. Dispatchers are pooled by IP (LRU, max 64) for keep-alive reuse — same pattern aslib/mcp/pinned-fetch.ts.new Anthropic({ fetch }), Azure OpenAI's chat-completionsnew AzureOpenAI({ fetch }), and both Responses-API configs via a new optionalResponsesProviderConfig.fetch(defaults to globalfetch).Type of Change
Testing
createPinnedFetchunit suite (8 tests): pinned lookup returns the validated IP for any hostname (IPv4/IPv6), dispatcher forwarding + init preservation, pooling/eviction.check:api-validationpasses, full security + provider suites green (453 tests).Checklist