Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client encryption - Fix bug in read path without encrypted properties #1242

Merged
merged 2 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ public async Task<Stream> DecryptAsync(
return input;
}

JObject itemJObj = EncryptionProcessor.baseSerializer.FromStream<JObject>(input);
JObject itemJObj;
abhijitpai marked this conversation as resolved.
Show resolved Hide resolved
using (StreamReader sr = new StreamReader(input, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, bufferSize: 1024, leaveOpen: true))
abhijitpai marked this conversation as resolved.
Show resolved Hide resolved
{
using (JsonTextReader jsonTextReader = new JsonTextReader(sr))
{
itemJObj = JsonSerializer.Create().Deserialize<JObject>(jsonTextReader);
}
}

JProperty encryptionPropertiesJProp = itemJObj.Property(Constants.Properties.EncryptedInfo);
JObject encryptionPropertiesJObj = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ await EncryptionTests.IterateDekFeedAsync(
}
}

[TestMethod]
public async Task EncryptionCreateItemWithoutEncryptionOptions()
{
TestDoc testDoc = TestDoc.Create();
ItemResponse<TestDoc> createResponse = await EncryptionTests.containerCore.CreateItemAsync(
testDoc,
new PartitionKey(testDoc.PK));
Assert.AreEqual(HttpStatusCode.Created, createResponse.StatusCode);
Assert.AreEqual(testDoc, createResponse.Resource);
}

[TestMethod]
public async Task EncryptionCreateItem()
{
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#1213](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1213) CosmosException now returns the original stack trace.
- [#1213](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1213) ResponseMessage.ErrorMessage is now always correctly populated. There was bug in some scenarios where the error message was left in the content stream.
- [#1242](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1242) Client encryption - Fix bug in read path without encrypted properties

## <a name="3.7.0-preview"/> [3.7.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.7.0-preview) - 2020-02-25

Expand Down