fix: derive OIDC ALLOWED_HOSTS from connection string hostname instead of hardcoded *.azure.com (fixes #639)#721
Open
hanhan761 wants to merge 2 commits into
Open
Conversation
…d of hardcoded *.azure.com (fixes microsoft#639)
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Replaces the hardcoded ['*.azure.com'] OIDC ALLOWED_HOSTS list with a helper that derives the allowed host from the actual connection string, enabling OIDC against sovereign clouds, private endpoints, and custom domains.
Changes:
- Adds a new
getOidcAllowedHostshelper that parses the connection string and falls back to['*.azure.com']on failure. - Uses the helper in both
MicrosoftEntraIDAuthHandlerand the playground worker in place of the hardcoded list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/documentdb/auth/oidcAllowedHosts.ts | New helper to extract the OIDC allowed host from a connection string with a safe fallback. |
| src/documentdb/auth/MicrosoftEntraIDAuthHandler.ts | Switches the OIDC auth handler to use the new helper. |
| src/documentdb/playground/playgroundWorker.ts | Switches the playground worker to use the new helper. |
…lowed hosts - Replace WHATWG URL parser with DocumentDBConnectionString to correctly handle multi-host connection strings and replica set seedlists - Extract '*.azure.com' fallback to named DEFAULT_ALLOWED_HOSTS constant - Return glob per host (*.hostname) for consistent OIDC matching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to 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
The OIDC \ALLOWED_HOSTS\ was hardcoded to ['*.azure.com']\ in two places, blocking Entra ID authentication for sovereign clouds (*.azure.cn, *.azure.us), private endpoints, and custom domains.
Changes
Issue
Fixes #639
Verification