Skip to content

Commit

Permalink
Client Encryption: Adds fix to retain the original key vault error/ex…
Browse files Browse the repository at this point in the history
…ception and upgrades core SDK package dependency. (Azure#3200)

* multi task each encryption/decryption.

* Update EncryptionProcessor.cs

* Update EncryptionProcessor.cs

* Update EncryptionProcessor.cs

* Update EncryptionProcessor.cs

* Update EncryptionProcessor.cs

* Update EncryptionProcessor.cs

* Update to latest package.

* Update EncryptionProcessor.cs

* Update changelog.md

* Update EncryptionSettingForProperty.cs

* Update Microsoft.Azure.Cosmos.Encryption.csproj

* Update Directory.Build.props

* Update changelog.md

* Update changelog.md

Co-authored-by: j82w <j82w@users.noreply.github.com>
  • Loading branch information
kr-santosh and j82w authored Jun 1, 2022
1 parent 1d0fdfd commit e50fbaa
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 114 deletions.
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<ClientPreviewVersion>3.27.1</ClientPreviewVersion>
<ClientPreviewSuffixVersion>preview</ClientPreviewSuffixVersion>
<DirectVersion>3.28.1</DirectVersion>
<EncryptionOfficialVersion>1.0.0</EncryptionOfficialVersion>
<EncryptionPreviewVersion>1.0.0</EncryptionPreviewVersion>
<EncryptionPreviewSuffixVersion>preview20</EncryptionPreviewSuffixVersion>
<EncryptionOfficialVersion>1.0.1</EncryptionOfficialVersion>
<EncryptionPreviewVersion>1.0.1</EncryptionPreviewVersion>
<EncryptionPreviewSuffixVersion>preview</EncryptionPreviewSuffixVersion>
<CustomEncryptionVersion>1.0.0-preview03</CustomEncryptionVersion>
<HybridRowVersion>1.1.0-preview3</HybridRowVersion>
<LangVersion>10.0</LangVersion>
Expand Down
11 changes: 11 additions & 0 deletions Microsoft.Azure.Cosmos.Encryption/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


### <a name="1.0.1"/> [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/1.0.1) - 2022-06-01

#### Added
- [#3200](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3200) Adds fix to retain the original key vault error/exception and upgrades core SDK package dependency.

### <a name="1.0.1-preview"/> [1.0.1-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/1.0.1-preview) - 2022-06-01

#### Added
- [#3200](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3200) Adds fix to retain the original key vault error/exception and upgrades core SDK preview package dependency.

### <a name="1.0.0"/> [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/1.0.0) - 2022-03-22

#### Added
- [#3070](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3070) Adds support for preview and non-preview version of Cosmos SDK in Encryption package.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public async Task<AeadAes256CbcHmac256EncryptionAlgorithm> BuildEncryptionAlgori
// bail out if this fails.
protectedDataEncryptionKey = await this.ForceRefreshGatewayCacheAndBuildProtectedDataEncryptionKeyAsync(
existingCekEtag: clientEncryptionKeyProperties.ETag,
refreshRetriedOnException: exOnRetry,
cancellationToken: cancellationToken);
}
}
Expand All @@ -100,6 +101,7 @@ public async Task<AeadAes256CbcHmac256EncryptionAlgorithm> BuildEncryptionAlgori
/// <returns>ProtectedDataEncryptionKey object. </returns>
private async Task<ProtectedDataEncryptionKey> ForceRefreshGatewayCacheAndBuildProtectedDataEncryptionKeyAsync(
string existingCekEtag,
Exception refreshRetriedOnException,
CancellationToken cancellationToken)
{
ClientEncryptionKeyProperties clientEncryptionKeyProperties;
Expand All @@ -123,7 +125,7 @@ private async Task<ProtectedDataEncryptionKey> ForceRefreshGatewayCacheAndBuildP
// looks like the key was never rewrapped with a valid Key Encryption Key.
throw new EncryptionCosmosException(
$"The Client Encryption Key with key id:{this.ClientEncryptionKeyId} on database:{this.encryptionContainer.Database.Id} and container:{this.encryptionContainer.Id} , needs to be rewrapped with a valid Key Encryption Key using RewrapClientEncryptionKeyAsync. " +
$" The Key Encryption Key used to wrap the Client Encryption Key has been revoked: {ex.Message}." +
$" The Key Encryption Key used to wrap the Client Encryption Key has been revoked: {refreshRetriedOnException.Message}. {ex.Message}." +
$" Please refer to https://aka.ms/CosmosClientEncryption for more details. ",
HttpStatusCode.BadRequest,
int.Parse(Constants.IncorrectContainerRidSubStatus),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
</ItemGroup>

<ItemGroup Condition=" '$(SdkProjectRef)' != 'True' AND '$(IsPreview)' != 'True' ">
<PackageReference Include="Microsoft.Azure.Cosmos" Version="[3.26.0,3.27)" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="[3.26.2,3.28)" />
</ItemGroup>

<ItemGroup Condition=" '$(SdkProjectRef)' != 'True' AND '$(IsPreview)' == 'True' ">
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.26.0-preview" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.27.1-preview" />
</ItemGroup>

<ItemGroup Condition=" '$(SdkProjectRef)' == 'True' ">
Expand Down
Loading

0 comments on commit e50fbaa

Please sign in to comment.