diff --git a/ElasticDatabaseTools.sln b/ElasticDatabaseTools.sln index 8cb16b1..8b388cd 100644 --- a/ElasticDatabaseTools.sln +++ b/ElasticDatabaseTools.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.10 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.SqlDatabase.ElasticScale.Client", "Src\ElasticScale.Client\Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj", "{4C3B3EC4-5702-469E-800E-313FB27A0A2B}" EndProject diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..e138ec5 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/Samples/Dapper/ElasticDapper.csproj b/Samples/Dapper/ElasticDapper.csproj index 848e5b8..43294c1 100644 --- a/Samples/Dapper/ElasticDapper.csproj +++ b/Samples/Dapper/ElasticDapper.csproj @@ -7,7 +7,7 @@ - + diff --git a/Samples/EFCodeFirst/EntityFrameworkCodeFirst.csproj b/Samples/EFCodeFirst/EntityFrameworkCodeFirst.csproj index 9cf7e70..327bf34 100644 --- a/Samples/EFCodeFirst/EntityFrameworkCodeFirst.csproj +++ b/Samples/EFCodeFirst/EntityFrameworkCodeFirst.csproj @@ -7,7 +7,7 @@ - + diff --git a/Samples/EFMultiTenant/EntityFrameworkMultiTenant.csproj b/Samples/EFMultiTenant/EntityFrameworkMultiTenant.csproj index ba4a50e..0b9f011 100644 --- a/Samples/EFMultiTenant/EntityFrameworkMultiTenant.csproj +++ b/Samples/EFMultiTenant/EntityFrameworkMultiTenant.csproj @@ -1,4 +1,4 @@ - + net5.0 Exe @@ -7,7 +7,7 @@ - + @@ -20,4 +20,4 @@ - \ No newline at end of file + diff --git a/Samples/ElasticScaleStarterKit/ElasticScaleStarterKit.csproj b/Samples/ElasticScaleStarterKit/ElasticScaleStarterKit.csproj index 2c542e6..d5b4faa 100644 --- a/Samples/ElasticScaleStarterKit/ElasticScaleStarterKit.csproj +++ b/Samples/ElasticScaleStarterKit/ElasticScaleStarterKit.csproj @@ -7,7 +7,7 @@ - + diff --git a/Samples/ShardSqlCmd/ShardSqlCmd.csproj b/Samples/ShardSqlCmd/ShardSqlCmd.csproj index 0b6c5c4..5b5fd7c 100644 --- a/Samples/ShardSqlCmd/ShardSqlCmd.csproj +++ b/Samples/ShardSqlCmd/ShardSqlCmd.csproj @@ -1,4 +1,5 @@ - + + net5.0 Exe @@ -10,4 +11,4 @@ - \ No newline at end of file + diff --git a/Src/ElasticScale.Client/Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj b/Src/ElasticScale.Client/Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj index 4445cc1..03b7dd6 100644 --- a/Src/ElasticScale.Client/Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj +++ b/Src/ElasticScale.Client/Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj @@ -12,7 +12,7 @@ Updated to net5.0 and migrated from System.Data.SqlClient to Microsoft.Data.SqlClient. http://go.microsoft.com/fwlink/?LinkID=288890 https://github.com/Azure/elastic-db-tools - https://github.com/Azure/elastic-db-tools/blob/master/LICENSE + MIT true git https://github.com/Azure/elastic-db-tools @@ -28,6 +28,7 @@ + True True @@ -51,4 +52,10 @@ + + + 2.1.2 + + + diff --git a/Src/ElasticScale.Client/Properties/AssemblyInfo.cs b/Src/ElasticScale.Client/Properties/AssemblyInfo.cs index 973cc34..419d6f7 100644 --- a/Src/ElasticScale.Client/Properties/AssemblyInfo.cs +++ b/Src/ElasticScale.Client/Properties/AssemblyInfo.cs @@ -14,7 +14,7 @@ [assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001007d813b35eaf89b7ae4be8a49086058380e083b58752b0a3a8323157e68b4b0f9fd78d2fe75e9ec253d8bb2225637d4c2393234e0f877bfddd7907eda8293083b7f4dbc664f09f6b62ce74266a4e79002783252559f5b23cfc682eb79b51a5f5d16dca2364413ae563b3ab6db2fc9da3ced11f9eef50421b982dfc3a08cb635a8")] [assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001007d813b35eaf89b7ae4be8a49086058380e083b58752b0a3a8323157e68b4b0f9fd78d2fe75e9ec253d8bb2225637d4c2393234e0f877bfddd7907eda8293083b7f4dbc664f09f6b62ce74266a4e79002783252559f5b23cfc682eb79b51a5f5d16dca2364413ae563b3ab6db2fc9da3ced11f9eef50421b982dfc3a08cb635a8")] -[assembly: CLSCompliant(true)] +//[assembly: CLSCompliant(true)] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1824:MarkAssembliesWithNeutralResourcesLanguage", Justification = "Too many dubious spelling errors.")] diff --git a/Src/ElasticScale.Client/Properties/Icon.png b/Src/ElasticScale.Client/Properties/Icon.png new file mode 100644 index 0000000..1e58d76 Binary files /dev/null and b/Src/ElasticScale.Client/Properties/Icon.png differ diff --git a/Src/ElasticScale.Client/ShardManagement/ShardMap/ShardMapUtils.cs b/Src/ElasticScale.Client/ShardManagement/ShardMap/ShardMapUtils.cs index 3269dba..acf08de 100644 --- a/Src/ElasticScale.Client/ShardManagement/ShardMap/ShardMapUtils.cs +++ b/Src/ElasticScale.Client/ShardManagement/ShardMap/ShardMapUtils.cs @@ -39,6 +39,10 @@ internal static class ShardMapUtils /// because it may not be available in the .NET framework version that we are running in /// internal static readonly string ActiveDirectoryInteractiveStr = "ActiveDirectoryInteractive"; + internal static readonly string ActiveDirectoryServicePrincipal = "ActiveDirectoryServicePrincipal"; + internal static readonly string ActiveDirectoryDeviceCodeFlow = "ActiveDirectoryDeviceCodeFlow"; + internal static readonly string ActiveDirectoryManagedIdentity = "ActiveDirectoryManagedIdentity"; + internal static readonly string ActiveDirectoryMSI = "ActiveDirectoryMSI"; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")] static ShardMapUtils() diff --git a/Src/ElasticScale.Client/ShardManagement/SqlStore/SqlShardMapManagerCredentials.cs b/Src/ElasticScale.Client/ShardManagement/SqlStore/SqlShardMapManagerCredentials.cs index 02ae635..a0c45f2 100644 --- a/Src/ElasticScale.Client/ShardManagement/SqlStore/SqlShardMapManagerCredentials.cs +++ b/Src/ElasticScale.Client/ShardManagement/SqlStore/SqlShardMapManagerCredentials.cs @@ -162,7 +162,12 @@ internal static void EnsureCredentials( { string authentication = connectionString[ShardMapUtils.Authentication].ToString(); if (authentication.Equals(ShardMapUtils.ActiveDirectoryIntegratedStr, StringComparison.OrdinalIgnoreCase) - || authentication.Equals(ShardMapUtils.ActiveDirectoryInteractiveStr, StringComparison.OrdinalIgnoreCase)) + || authentication.Equals(ShardMapUtils.ActiveDirectoryInteractiveStr, StringComparison.OrdinalIgnoreCase) + || authentication.Equals(ShardMapUtils.ActiveDirectoryManagedIdentity, StringComparison.OrdinalIgnoreCase) + || authentication.Equals(ShardMapUtils.ActiveDirectoryServicePrincipal, StringComparison.OrdinalIgnoreCase) + || authentication.Equals(ShardMapUtils.ActiveDirectoryDeviceCodeFlow, StringComparison.OrdinalIgnoreCase) + || authentication.Equals(ShardMapUtils.ActiveDirectoryMSI, StringComparison.OrdinalIgnoreCase) + ) { return; } diff --git a/Src/ElasticScale.Client/ShardManagement/Utils/ExceptionUtils.cs b/Src/ElasticScale.Client/ShardManagement/Utils/ExceptionUtils.cs index 10ba332..bbfb82d 100644 --- a/Src/ElasticScale.Client/ShardManagement/Utils/ExceptionUtils.cs +++ b/Src/ElasticScale.Client/ShardManagement/Utils/ExceptionUtils.cs @@ -96,8 +96,8 @@ internal static ShardManagementException GetStoreExceptionGlobal( category, ShardManagementErrorCode.StorageOperationFailure, Errors._Store_SqlExceptionGlobal, - storeException.InnerException != null ? storeException.InnerException.Message : storeException.Message, storeException, + storeException.InnerException != null ? storeException.InnerException.Message : storeException.Message, operationName); } diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..ed167f6 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,156 @@ +# .NET Desktop +# Build and run tests for .NET Desktop or Windows classic desktop solutions. +# Add steps that publish symbols, save build artifacts, and more: +# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net + +trigger: +- master + +pool: + vmImage: 'windows-latest' + +variables: + solution: '**/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + +steps: +- task: NuGetToolInstaller@1 + +- task: NuGetCommand@2 + inputs: + restoreSolution: '$(solution)' + +- task: VSBuild@1 + inputs: + solution: '$(solution)' + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' + +# - task: VSTest@2 +# inputs: +# platform: '$(buildPlatform)' +# configuration: '$(buildConfiguration)' + +- task: EsrpCodeSigning@2 + displayName: ESRP CodeSigning - *.dll + inputs: + ConnectedServiceName: 'Code Signing' + FolderPath: src + Pattern: '*.dll' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd sha256" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "signtool.exe", + "toolVersion": "6.2.9304.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ + { + "parameterName": "VerifyAll", + "parameterValue": "/all" + } + ], + "toolName": "signtool.exe", + "toolVersion": "6.2.9304.0" + } + ] + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + +- task: DotNetCoreCLI@2 + name: DotNetCoreCLI3 + displayName: dotnet pack + inputs: + command: pack + searchPatternPack: Src/**/*.csproj + outputDir: $(Build.ArtifactStagingDirectory)\pkg + nobuild: true + +- task: EsrpCodeSigning@2 + displayName: ESRP CodeSigning - *.nupkg + inputs: + ConnectedServiceName: 'Code Signing' + FolderPath: $(Build.ArtifactStagingDirectory)\pkg + Pattern: '*.nupkg' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd sha256" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "signtool.exe", + "toolVersion": "6.2.9304.0" + }, + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ + { + "parameterName": "VerifyAll", + "parameterValue": "/all" + } + ], + "toolName": "signtool.exe", + "toolVersion": "6.2.9304.0" + } + ] + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + +- task: PublishPipelineArtifact@1 + displayName: 'Publish release' + inputs: + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: ElasticScaleClientLibrary