Skip to content

Commit 2d3d232

Browse files
authored
Merge branch 'master' into ernestoc/stringCompareTo
2 parents 9b944ac + ea10439 commit 2d3d232

File tree

314 files changed

+34256
-5443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+34256
-5443
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Create a report to help us improve
44
title: ''
5-
labels: ''
5+
labels: needs-investigation
66
assignees: ''
77

88
---

.github/fabricbot.json

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"capabilityId": "ScheduledSearch",
77
"subCapability": "ScheduledSearch",
88
"version": "1.1",
9-
"id": "a-PNOJWK3Jbr7QY7vkc2O",
109
"config": {
1110
"frequency": [
1211
{
@@ -50,6 +49,134 @@
5049
]
5150
},
5251
"disabled": true
52+
},
53+
{
54+
"taskType": "trigger",
55+
"capabilityId": "IssueResponder",
56+
"subCapability": "IssuesOnlyResponder",
57+
"version": "1.0",
58+
"config": {
59+
"conditions": {
60+
"operator": "and",
61+
"operands": [
62+
{
63+
"operator": "not",
64+
"operands": [
65+
{
66+
"name": "isAssignedToSomeone",
67+
"parameters": {}
68+
}
69+
]
70+
},
71+
{
72+
"name": "isAction",
73+
"parameters": {
74+
"action": "opened"
75+
}
76+
},
77+
{
78+
"operator": "not",
79+
"operands": [
80+
{
81+
"name": "hasLabel",
82+
"parameters": {
83+
"label": "needs-investigation"
84+
}
85+
}
86+
]
87+
}
88+
]
89+
},
90+
"eventType": "issue",
91+
"eventNames": [
92+
"issues",
93+
"project_card"
94+
],
95+
"taskName": "Add needs-investigation",
96+
"actions": [
97+
{
98+
"name": "addLabel",
99+
"parameters": {
100+
"label": "needs-investigation"
101+
}
102+
}
103+
]
104+
}
105+
},
106+
{
107+
"taskType": "trigger",
108+
"capabilityId": "AutoMerge",
109+
"subCapability": "AutoMerge",
110+
"version": "1.0",
111+
"config": {
112+
"taskName": "PR Automerge",
113+
"allowAutoMergeInstructionsWithoutLabel": false,
114+
"mergeType": "squash",
115+
"deleteBranches": true,
116+
"removeLabelOnPush": true,
117+
"label": "auto-merge",
118+
"requireAllStatuses": false,
119+
"requireSpecificCheckRuns": false,
120+
"usePrDescriptionAsCommitMessage": false,
121+
"minMinutesOpen": "60",
122+
"enforceDMPAsStatus": true
123+
}
124+
},
125+
{
126+
"taskType": "scheduled",
127+
"capabilityId": "ScheduledSearch",
128+
"subCapability": "ScheduledSearch",
129+
"version": "1.1",
130+
"config": {
131+
"frequency": [
132+
{
133+
"weekDay": 1,
134+
"hours": [
135+
9
136+
],
137+
"timezoneOffset": -7
138+
}
139+
],
140+
"searchTerms": [
141+
{
142+
"name": "isOpen",
143+
"parameters": {}
144+
},
145+
{
146+
"name": "isIssue",
147+
"parameters": {}
148+
},
149+
{
150+
"name": "hasLabel",
151+
"parameters": {
152+
"label": "needs-more-information"
153+
}
154+
},
155+
{
156+
"name": "noActivitySince",
157+
"parameters": {
158+
"days": 14
159+
}
160+
},
161+
{
162+
"name": "noAssignees",
163+
"parameters": {}
164+
}
165+
],
166+
"taskName": "Close inactive needs-information",
167+
"actions": [
168+
{
169+
"name": "addReply",
170+
"parameters": {
171+
"comment": "@${issueAuthor} this issue requires more information for the team to be able to help. In case this information is available, please add it and re-open the Issue."
172+
}
173+
},
174+
{
175+
"name": "closeIssue",
176+
"parameters": {}
177+
}
178+
]
179+
}
53180
}
54181
],
55182
"userGroups": []

Directory.Build.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<ClientOfficialVersion>3.32.0</ClientOfficialVersion>
4-
<ClientPreviewVersion>3.32.0</ClientPreviewVersion>
3+
<ClientOfficialVersion>3.34.0</ClientOfficialVersion>
4+
<ClientPreviewVersion>3.34.0</ClientPreviewVersion>
55
<ClientPreviewSuffixVersion>preview</ClientPreviewSuffixVersion>
6-
<DirectVersion>3.30.1</DirectVersion>
7-
<EncryptionOfficialVersion>2.0.1</EncryptionOfficialVersion>
8-
<EncryptionPreviewVersion>2.0.1</EncryptionPreviewVersion>
6+
<DirectVersion>3.31.1</DirectVersion>
7+
<EncryptionOfficialVersion>2.0.2</EncryptionOfficialVersion>
8+
<EncryptionPreviewVersion>2.0.2</EncryptionPreviewVersion>
99
<EncryptionPreviewSuffixVersion>preview</EncryptionPreviewSuffixVersion>
10-
<CustomEncryptionVersion>1.0.0-preview04</CustomEncryptionVersion>
10+
<CustomEncryptionVersion>1.0.0-preview05</CustomEncryptionVersion>
1111
<HybridRowVersion>1.1.0-preview3</HybridRowVersion>
1212
<LangVersion>10.0</LangVersion>
1313
<AboveDirBuildProps>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</AboveDirBuildProps>

Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Preview features are treated as a separate branch and will not be included in th
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
### <a name="1.0.0-preview05"/> [1.0.0-preview05](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview05) - 2023-04-27
7+
8+
#### Fixes
9+
- [#3809](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3809) Adds api FetchDataEncryptionKeyWithoutRawKeyAsync and FetchDataEncryptionKey to get DEK without and with raw key respectively.
10+
611
### <a name="1.0.0-preview04"/> [1.0.0-preview04](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview04) - 2022-08-16
712

813
#### Fixes

Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosDataEncryptionKeyProvider.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,25 @@ public async Task InitializeAsync(
166166
this.container = containerResponse.Container;
167167
}
168168

169+
/// <inheritdoc/>
170+
public override async Task<DataEncryptionKey> FetchDataEncryptionKeyWithoutRawKeyAsync(
171+
string id,
172+
string encryptionAlgorithm,
173+
CancellationToken cancellationToken)
174+
{
175+
return await this.FetchDekAsync(id, encryptionAlgorithm, cancellationToken);
176+
}
177+
169178
/// <inheritdoc/>
170179
public override async Task<DataEncryptionKey> FetchDataEncryptionKeyAsync(
171180
string id,
172181
string encryptionAlgorithm,
173182
CancellationToken cancellationToken)
183+
{
184+
return await this.FetchDekAsync(id, encryptionAlgorithm, cancellationToken, true);
185+
}
186+
187+
private async Task<DataEncryptionKey> FetchDekAsync(string id, string encryptionAlgorithm, CancellationToken cancellationToken, bool withRawKey = false)
174188
{
175189
DataEncryptionKeyProperties dataEncryptionKeyProperties = await this.dataEncryptionKeyContainerCore.FetchDataEncryptionKeyPropertiesAsync(
176190
id,
@@ -200,7 +214,8 @@ public override async Task<DataEncryptionKey> FetchDataEncryptionKeyAsync(
200214
InMemoryRawDek inMemoryRawDek = await this.dataEncryptionKeyContainerCore.FetchUnwrappedAsync(
201215
dataEncryptionKeyProperties,
202216
diagnosticsContext: CosmosDiagnosticsContext.Create(null),
203-
cancellationToken: cancellationToken);
217+
cancellationToken: cancellationToken,
218+
withRawKey);
204219

205220
return inMemoryRawDek.DataEncryptionKey;
206221
}

Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosEncryptor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public override async Task<byte[]> DecryptAsync(
3535
string encryptionAlgorithm,
3636
CancellationToken cancellationToken = default)
3737
{
38-
DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync(
38+
DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync(
3939
dataEncryptionKeyId,
4040
encryptionAlgorithm,
4141
cancellationToken);
4242

4343
if (dek == null)
4444
{
45-
throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync)}.");
45+
throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync)}.");
4646
}
4747

4848
return dek.DecryptData(cipherText);
@@ -55,14 +55,14 @@ public override async Task<byte[]> EncryptAsync(
5555
string encryptionAlgorithm,
5656
CancellationToken cancellationToken = default)
5757
{
58-
DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync(
58+
DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync(
5959
dataEncryptionKeyId,
6060
encryptionAlgorithm,
6161
cancellationToken);
6262

6363
if (dek == null)
6464
{
65-
throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync)}.");
65+
throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync)}.");
6666
}
6767

6868
return dek.EncryptData(plainText);

Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyContainerCore.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ internal async Task<DataEncryptionKey> FetchUnWrappedMdeSupportedLegacyDekAsync(
335335
unwrapResult.DataEncryptionKey);
336336

337337
return new MdeEncryptionAlgorithm(
338+
unwrapResult.DataEncryptionKey,
338339
plaintextDataEncryptionKey,
339340
Data.Encryption.Cryptography.EncryptionType.Randomized);
340341
}
@@ -378,13 +379,14 @@ internal async Task<DataEncryptionKey> FetchUnWrappedLegacySupportedMdeDekAsync(
378379
internal async Task<InMemoryRawDek> FetchUnwrappedAsync(
379380
DataEncryptionKeyProperties dekProperties,
380381
CosmosDiagnosticsContext diagnosticsContext,
381-
CancellationToken cancellationToken)
382+
CancellationToken cancellationToken,
383+
bool withRawKey = false)
382384
{
383385
try
384386
{
385387
if (string.Equals(dekProperties.EncryptionAlgorithm, CosmosEncryptionAlgorithm.MdeAeadAes256CbcHmac256Randomized))
386388
{
387-
DataEncryptionKey dek = this.InitMdeEncryptionAlgorithm(dekProperties);
389+
DataEncryptionKey dek = this.InitMdeEncryptionAlgorithm(dekProperties, withRawKey);
388390

389391
// TTL is not used since DEK is not cached.
390392
return new InMemoryRawDek(dek, TimeSpan.FromMilliseconds(0));
@@ -564,7 +566,7 @@ private async Task<EncryptionKeyUnwrapResult> UnWrapDekMdeEncAlgoAsync(
564566
return unwrapResult;
565567
}
566568

567-
internal DataEncryptionKey InitMdeEncryptionAlgorithm(DataEncryptionKeyProperties dekProperties)
569+
internal DataEncryptionKey InitMdeEncryptionAlgorithm(DataEncryptionKeyProperties dekProperties, bool withRawKey = false)
568570
{
569571
if (this.DekProvider.MdeKeyWrapProvider == null)
570572
{
@@ -576,7 +578,8 @@ internal DataEncryptionKey InitMdeEncryptionAlgorithm(DataEncryptionKeyPropertie
576578
dekProperties,
577579
Data.Encryption.Cryptography.EncryptionType.Randomized,
578580
this.DekProvider.MdeKeyWrapProvider.EncryptionKeyStoreProvider,
579-
this.DekProvider.PdekCacheTimeToLive);
581+
this.DekProvider.PdekCacheTimeToLive,
582+
withRawKey);
580583
}
581584

582585
private async Task<DataEncryptionKeyProperties> ReadResourceAsync(

Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyProvider.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
1414
public abstract class DataEncryptionKeyProvider
1515
{
1616
/// <summary>
17-
/// Retrieves the data encryption key for the given id.
17+
/// Retrieves the data encryption key for the given id without rawkey. RawKey will be set to null.
18+
/// </summary>
19+
/// <param name="id">Identifier of the data encryption key.</param>
20+
/// <param name="encryptionAlgorithm">Encryption algorithm that the retrieved key will be used with.</param>
21+
/// <param name="cancellationToken">Token for request cancellation.</param>
22+
/// <returns>Data encryption key bytes.</returns>
23+
public abstract Task<DataEncryptionKey> FetchDataEncryptionKeyWithoutRawKeyAsync(
24+
string id,
25+
string encryptionAlgorithm,
26+
CancellationToken cancellationToken);
27+
28+
/// <summary>
29+
/// Retrieves the data encryption key for the given id with RawKey value.
1830
/// </summary>
1931
/// <param name="id">Identifier of the data encryption key.</param>
2032
/// <param name="encryptionAlgorithm">Encryption algorithm that the retrieved key will be used with.</param>

Microsoft.Azure.Cosmos.Encryption.Custom/src/EncryptionContainer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,6 @@ public override Task<IReadOnlyList<FeedRange>> GetFeedRangesAsync(
791791
return this.container.GetFeedRangesAsync(cancellationToken);
792792
}
793793

794-
public override Task<IEnumerable<string>> GetPartitionKeyRangesAsync(
795-
FeedRange feedRange,
796-
CancellationToken cancellationToken = default)
797-
{
798-
return this.container.GetPartitionKeyRangesAsync(feedRange, cancellationToken);
799-
}
800-
801794
public override FeedIterator GetItemQueryStreamIterator(
802795
FeedRange feedRange,
803796
QueryDefinition queryDefinition,
@@ -1010,6 +1003,14 @@ public override async Task<FeedResponse<T>> ReadManyItemsAsync<T>(
10101003
return this.ResponseFactory.CreateItemFeedResponse<T>(responseMessage);
10111004
}
10121005

1006+
#if ENCRYPTIONPREVIEW
1007+
public override Task<IEnumerable<string>> GetPartitionKeyRangesAsync(
1008+
FeedRange feedRange,
1009+
CancellationToken cancellationToken = default)
1010+
{
1011+
return this.container.GetPartitionKeyRangesAsync(feedRange, cancellationToken);
1012+
}
1013+
10131014
public override Task<ResponseMessage> DeleteAllItemsByPartitionKeyStreamAsync(
10141015
Cosmos.PartitionKey partitionKey,
10151016
RequestOptions requestOptions = null,
@@ -1020,6 +1021,7 @@ public override Task<ResponseMessage> DeleteAllItemsByPartitionKeyStreamAsync(
10201021
requestOptions,
10211022
cancellationToken);
10221023
}
1024+
#endif
10231025

10241026
private async Task<ResponseMessage> ReadManyItemsHelperAsync(
10251027
IReadOnlyList<(string id, PartitionKey partitionKey)> items,

0 commit comments

Comments
 (0)