Skip to content

fix: pin Azure instance identity roots on all platforms#25390

Draft
jdomeracki-coder wants to merge 1 commit into
mainfrom
fix/azure-identity-pin-roots-all-platforms
Draft

fix: pin Azure instance identity roots on all platforms#25390
jdomeracki-coder wants to merge 1 commit into
mainfrom
fix/azure-identity-pin-roots-all-platforms

Conversation

@jdomeracki-coder
Copy link
Copy Markdown
Contributor

@jdomeracki-coder jdomeracki-coder commented May 15, 2026

Commit 132fa87 (#25312) changed non-darwin platforms to use x509.SystemCertPool() for Azure instance identity verification. This broadened the trust boundary from 3 specific Azure root CAs to the entire OS trust store, allowing any system-trusted CA to potentially sign metadata documents accepted by the unauthenticated /api/v2/workspaceagents/azure-instance-identity endpoint.

This PR re-embeds Azure root CAs on all platforms, making root-pinning the secure default. A new --azure-instance-identity-root-ca-path flag (CODER_AZURE_INSTANCE_IDENTITY_ROOT_CA_PATH) lets operators override the embedded roots with a custom PEM file when Azure rotates CAs before a Coder binary update.

Security analysis

The previous code on non-darwin had rootCertPool() returning x509.SystemCertPool(), which means any root CA in the host OS trust store (enterprise CAs, public WebPKI roots, etc.) could anchor a certificate chain accepted by Validate. The only other identity check is a CN regex (metadata.azure.*). Since the Azure auth endpoint is unauthenticated and returns agent session tokens, widening the trust store increases the attack surface for environments with enterprise or custom CAs.

Note

Generated by Coder Agents on behalf of @jdomeracki-coder

Embed Azure root CAs on all platforms instead of falling back to
x509.SystemCertPool() on non-darwin. This pins trust to the known
Azure certificate chain by default, preventing any system-trusted
CA from signing metadata documents accepted by Validate.

Add --azure-instance-identity-root-ca-path flag
(CODER_AZURE_INSTANCE_IDENTITY_ROOT_CA_PATH) so operators can
override the embedded roots with a custom PEM file when Azure
rotates CAs before a Coder binary update.
@jdomeracki-coder jdomeracki-coder force-pushed the fix/azure-identity-pin-roots-all-platforms branch from 32269eb to ad3da79 Compare May 15, 2026 12:56
@jdomeracki-coder jdomeracki-coder changed the title fix(coderd/azureidentity): pin Azure roots on all platforms fix: pin Azure instance identity roots on all platforms May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant