Skip to content

Harden Azure Key Vault trusted endpoint matching #4802

Description

@paulmedynski

Is your feature request related to a problem? Please describe.

SqlColumnEncryptionAzureKeyVaultProvider validates an Azure Key Vault key URI by checking whether Uri.Host ends with one of its trusted endpoint strings. Raw suffix matching does not require a DNS-label boundary, so a hostname can match a trusted suffix without being that domain or one of its subdomains.

The trusted-endpoint representation also does not express whether an entry is an exact host, a DNS suffix, or a complete origin. This makes it difficult to apply clear scheme and port rules to application-supplied endpoints while preserving compatibility with custom Azure environments and development endpoints.

Describe the solution you'd like

Harden and clarify trusted endpoint validation:

  • Match built-in domain suffixes only when the host is exactly the suffix or ends with "." + suffix, using ordinal case-insensitive comparison.
  • Normalize DNS hosts consistently, including IDN and terminal-dot handling.
  • Require HTTPS for built-in Azure Key Vault and Managed HSM endpoints.
  • Validate and normalize application-supplied trusted endpoints when the provider is constructed.
  • Provide structured semantics for custom endpoints, distinguishing exact origins from entries that intentionally include DNS subdomains.
  • Defensively copy trusted endpoint collections so validation policy cannot be changed by mutating the constructor input.
  • Preserve reasonable compatibility for existing custom endpoints, with diagnostics and an explicit migration path for ambiguous legacy entries.

Add tests covering:

  • Valid exact hosts and subdomains.
  • Lookalike suffixes that do not share a DNS-label boundary.
  • Hosts that append another DNS suffix after a trusted name.
  • Mixed-case, IDN, and terminal-dot hostnames.
  • HTTP, HTTPS, default ports, and explicit custom ports.
  • Mutation of the input trusted-endpoint array after construction.

Describe alternatives you've considered

  • Keep raw EndsWith matching. This retains ambiguous behavior and does not accurately model DNS domain membership.
  • Require exact host matching for every entry. This would not work for the built-in Azure Key Vault domains, where each vault has its own subdomain.
  • Immediately reject every legacy custom endpoint format. This would provide simpler rules but could unnecessarily disrupt applications using private clouds, proxies, or development services. A compatibility-conscious migration to structured endpoint rules is preferable.

Additional context

The current built-in list covers Azure Key Vault and Managed HSM domains in public and sovereign clouds. DNS-label-boundary matching should preserve valid hostnames beneath those domains while making the allowlist behavior precise.

Activity

  1. added
    Area\AKV Provider
    on Oct 7, 2026
  2. added this to the 8.0.0-preview1 milestone on Oct 7, 2026
  3. github-actions commented on Oct 7, 2026

    @github-actions

    🔍 Triage Summary

    Check Result
    Issue type Feature
    Environment N/A (feature request; environment validation applies to bugs only)
    Area Area\AKV Provider
    Duplicates None found
    Regression Not indicated

    Analysis

    Proposes hardening trusted-endpoint validation in SqlColumnEncryptionAzureKeyVaultProvider: DNS-label-boundary suffix matching, HTTPS enforcement for built-in endpoints, host normalization (IDN, terminal dot), structured custom endpoint semantics, and defensive copying of the input collection. It has security-hardening implications (lookalike host acceptance), so treat as roughly P1-P2. Compatibility for existing custom endpoints is the main design risk.

    Next Steps

    • Maintainers should confirm the structured custom-endpoint API shape (exact origin vs. DNS-suffix entries) and review it against .github/instructions/api-design.instructions.md, since it likely changes the public API in ref/.
    • Once the design is agreed, assign to Copilot coding agent to implement the label-boundary matching, HTTPS requirement, and constructor-time normalization/copy in the AKV provider (src/Microsoft.Data.SqlClient/add-ons/), with the tests listed in the issue (lookalike suffixes, mixed-case/IDN/terminal-dot hosts, ports, array mutation).
    • Plan a diagnostic and migration path for ambiguous legacy custom endpoints, and document it under doc/.

    Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.

    Generated by SqlClient Issue Auto-Triage for #4802 · copilot · auto · 24.4 AIC · ⌖ 11.7 AIC · ⊞ 13.5K · ◷

  4. moved this from To triage to Backlog in SqlClient Boardon Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area\AKV Provider

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions