You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validate region string format before use in URL construction #1028
The discoverRegion method in AadInstanceDiscoveryProvider.java returns the region string from either the REGION_NAME environment variable or the IMDS endpoint response without validating its format. This region is then used in getRegionalizedHost to construct authority URLs via string replacement (e.g., {region}.login.microsoft.com).
If the region string contains unexpected characters (dots, slashes, etc.), the resulting URL could be malformed and lead to failed or misdirected requests.
Azure region names follow a consistent pattern of lowercase alphanumeric characters and hyphens (e.g., eastus, westus2, east-us-2).
Proposed fix: Validate the region string against a pattern like ^[a-z][a-z0-9-]*$ at discovery time (in discoverRegion) and treat invalid values as if no region was detected.
Activity
gterminator commentedon Jul 30, 2026
Avery-Dunn Bogdan Gavril (@bgavrilMS) may this PR fits?
AzureAD#1028 address review feedback on PR AzureAD#1051
AzureAD#1028 fall back to global endpoint on invalid auto-detected re…
#1028 validate region string format before use in URL construction
Merge pull request #1051 from gterminator/feature/issue-1028_validate…