fix(providers): pin Azure OpenAI/Anthropic endpoints to validated IP#5060
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview Adds shared For user-supplied Azure endpoints only: after validation, providers require a New/updated unit tests cover pinned fetch behavior and Azure pinning paths (pin vs env vs blocked vs missing IP). Reviewed by Cursor Bugbot for commit 3b4ef1d. Configure here. |
Greptile SummaryThis PR closes a TOCTOU DNS-rebinding SSRF vulnerability in the Azure OpenAI and Azure Anthropic providers: both previously validated the user-supplied endpoint with
Confidence Score: 5/5The change is safe to merge: the SSRF fix is correctly applied to all three Azure OpenAI code paths and to the Anthropic provider, the fail-closed guard prevents silent bypass when The core security logic — pinning DNS resolution via an undici Agent before handing the URL to the SDK — is sound and well-tested. All direct apps/sim/lib/mcp/pinned-fetch.ts — the inner-closure placement of Important Files Changed
Reviews (7): Last reviewed commit: "refactor(security): drop pinned-fetch ag..." | Re-trigger Greptile |
|
Thanks @greptile-apps — addressed in c8c4867:
|
|
Both fixes look correct and well-reasoned. The fail-closed guard is exactly right — if The duplication deferral rationale holds. Touching Both concerns addressed — LGTM. |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c8c4867. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 081d0e4. Configure here.
|
@greptile review |
|
@cursor review |
081d0e4 to
112734e
Compare
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 112734e. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 112734e. Configure here.
|
@greptile review |
112734e to
3b4ef1d
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3b4ef1d. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3b4ef1d. Configure here.
…er node:net in client bundle The browser build broke with `Cannot find module 'node:net'`. Server-only SSRF code in `input-validation.server.ts` (`dns/promises`, and since PR #5060 `undici` → `node:net`/`node:tls`) is statically reachable from the client bundle via the tool/connector registries, which the workflow editor imports for metadata. Node networking builtins have no browser shim, so Turbopack cannot compile them for the client. Two changes: 1. Split each connector's client-safe declarative metadata into a sibling `meta.ts` (`<name>ConnectorMeta`), mirroring the `XBlockMeta` / `BLOCK_META_REGISTRY` pattern. `connectors/registry.ts` is now the client-safe `CONNECTOR_META_REGISTRY` (+ `getConnectorMeta` / `getAllConnectorMeta`); the full registry with runtime fns moves to `connectors/registry.server.ts`. Client components consume the meta registry; the sync engine and knowledge API routes consume the server registry. This removes connectors from the client's server-only graph. Connector metadata is byte-for-byte identical before/after; runtime fns are untouched. 2. Extend the existing #4899 `turbopack.resolveAlias` browser stub — which already mapped `dns`/`dns/promises` to an empty module for the browser — to also cover `net`/`tls` (+ `node:` variants), since `undici` now pulls those in. The remaining tool/provider definitions still reach `input-validation.server` server-side; the browser-only stub keeps those Node builtins out of the client bundle while the real modules stay on the server, so SSRF validation and IP pinning are unaffected. Connector authoring/validation skills updated to teach the meta.ts split.
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