Verify Azure DLL via public key token#3978
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates strong-name signing configuration from individual project files into a centralized Directory.Build.props file and adds public key token validation for the Azure extension assembly. The changes improve maintainability by eliminating duplicated signing configuration across 11 project files and enhance security by verifying that dynamically loaded Azure authentication provider assemblies are signed with Microsoft's key.
Changes:
- Centralized strong-name signing configuration in
src/Directory.Build.propswith automatic STRONG_NAME_SIGNING preprocessor constant - Removed duplicated signing configuration from 11 project files (SqlClient main/ref, SqlServer.Server, Extensions packages, AKV Provider)
- Added conditional public key token verification for Azure extension assembly in SqlAuthenticationProviderManager
- Updated pipeline template comment to reflect generic usage (not just Extension packages)
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Directory.Build.props | Added centralized strong-name signing configuration with SignAssembly, AssemblyOriginatorKeyFile, and STRONG_NAME_SIGNING constant when SigningKeyPath is specified |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs | Added conditional public key token validation (23ec7fc2d6eaa4a5) for Azure extension assembly when STRONG_NAME_SIGNING is enabled |
| src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj | Removed duplicated signing configuration, kept InternalsVisibleTo condition for unsigned builds |
| src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj | Removed signing configuration (now inherited from Directory.Build.props) |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj | Removed duplicated signing configuration (legacy project) |
| src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj | Removed signing configuration (legacy ref project) |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj | Removed duplicated signing configuration (legacy project) |
| src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj | Removed signing configuration (legacy ref project) |
| src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj | Removed signing configuration and simplified Trim/AOT property group |
| src/Microsoft.Data.SqlClient.Extensions/Logging/src/Logging.csproj | Removed duplicated signing configuration |
| src/Microsoft.Data.SqlClient.Extensions/Azure/src/Azure.csproj | Removed duplicated signing configuration |
| src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj | Removed duplicated signing configuration |
| src/Microsoft.SqlServer.Server/Microsoft.SqlServer.Server.csproj | Removed signing configuration block |
| eng/pipelines/steps/compound-build-csproj-step.yml | Updated comment to reflect generic usage (not just Extension packages) |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Show resolved
Hide resolved
bc7bdb2 to
873c96e
Compare
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Outdated
Show resolved
Hide resolved
|
@paulmedynski I've opened a new pull request, #3983, to work on those changes. Once the pull request is ready, I'll request review from you. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3978 +/- ##
==========================================
- Coverage 72.43% 64.59% -7.84%
==========================================
Files 287 282 -5
Lines 43105 66025 +22920
==========================================
+ Hits 31225 42652 +11427
- Misses 11880 23373 +11493
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/Microsoft.Data.SqlClient.Extensions/Logging/src/SqlClientEventSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient.Extensions/Logging/src/SqlClientEventSource.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs
Show resolved
Hide resolved
- Consolidated strong name signing into Directory.Build.props. - Added a conditional compilation constant for strong name signing. - Added public key token check when SqlClient loads the Azure assembly. - Added logging related to Azure assembly loading. - Added explicit check for .NET runtime. - Added a way to define whatever conditional compilation constants we want on the command-line.
8884ab4 to
4d0a127
Compare
Description
Testing