Case Study
← All case studiesHardcoded Authority URL in Azure AD Identity Model
Context
Azure Active Directory identity model extensions PR#3410 introduced a hardcoded authority URL string in production code. Authority URLs in identity libraries must be configurable - they vary by Azure environment (global, US Government, China, Germany), by tenant, and by deployment stage. Hardcoding one means sovereign cloud deployments silently authenticate against the wrong authority, and local/staging environments cannot override it without patching the binary.
Diff evidence
[GCI0010] Hardcoding and Configuration
Location : src/.../ValidateSignature method
Summary : Possible hardcoded configuration value ('authority' assigned a string literal).
Evidence : var authority = "https://login.microsoftonline.com/";
Why : Hardcoded URLs and configuration values prevent environment-specific
overrides and will silently misbehave in staging, sovereign cloud, or
air-gapped deployments.
Action : Inject via constructor, read from configuration, or use a constant
defined in a dedicated configuration class.Why it matters
Azure Active Directory is used by hundreds of thousands of enterprise applications for authentication. The identity model extensions library is the foundation of all MSAL and ADAL token validation. A hardcoded authority URL means sovereign cloud customers (US Government, Azure China, Azure Germany) who use different login endpoints cannot configure the correct authority without forking the library. Staging environments that point at a test tenant also cannot override it. The failure mode is silent - tokens validate against the wrong authority, potentially accepting tokens from unintended tenants or rejecting legitimate ones.
Detection rules
- GCI0010 - Hardcoding and Configuration - flags string literals assigned to variables named after configuration concepts (authority, url, endpoint, host, etc.).
- GCI0003 - Behavioral Change Detection - flags changes that alter externally observable behavior including authentication flows.
