fix: pin Azure instance identity roots on all platforms#25390
Draft
jdomeracki-coder wants to merge 1 commit into
Draft
fix: pin Azure instance identity roots on all platforms#25390jdomeracki-coder wants to merge 1 commit into
jdomeracki-coder wants to merge 1 commit into
Conversation
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.
32269eb to
ad3da79
Compare
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.
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-identityendpoint.This PR re-embeds Azure root CAs on all platforms, making root-pinning the secure default. A new
--azure-instance-identity-root-ca-pathflag (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()returningx509.SystemCertPool(), which means any root CA in the host OS trust store (enterprise CAs, public WebPKI roots, etc.) could anchor a certificate chain accepted byValidate. 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