@@ -30,6 +30,24 @@ module
30
30
}
31
31
32
32
predicate ValidWholeSearchConfig (config : ET .DynamoDbTablesEncryptionConfig)
33
+ reads
34
+ set
35
+ t < - config. tableEncryptionConfigs |
36
+ config. tableEncryptionConfigs[t]. search. Some?,
37
+ c < - config. tableEncryptionConfigs[t]. search. value. versions |
38
+ && c. keySource. multi?
39
+ && c. keySource. multi. cache. Some?
40
+ && c. keySource. multi. cache. value. Shared?
41
+ :: c. keySource. multi. cache. value. Shared,
42
+ set
43
+ t < - config. tableEncryptionConfigs |
44
+ config. tableEncryptionConfigs[t]. search. Some?,
45
+ f < - config. tableEncryptionConfigs[t]. search. value. versions |
46
+ && f. keySource. multi?
47
+ && f. keySource. multi. cache. Some?
48
+ && f. keySource. multi. cache. value. Shared?,
49
+ o < - f. keySource. multi. cache. value. Shared. Modifies
50
+ :: o
33
51
{
34
52
forall t < - config. tableEncryptionConfigs
35
53
::
@@ -148,7 +166,54 @@ module
148
166
// tmp27.keySource.multi.cache.value.Shared.ValidState()
149
167
// }
150
168
151
- method {:vcs_split_on_every_assert} DynamoDbEncryptionTransforms (config: AwsCryptographyDbEncryptionSdkDynamoDbTypes .DynamoDbTablesEncryptionConfig)
169
+
170
+ // //= specification/dynamodb-encryption-client/ddb-sdk-integration.md#dynamodb-table-encryption-configs
171
+ // //# During initialization, this client MUST construct a
172
+ // //# [DynamoDb Item Encryptor](./ddb-table-encryption-config.md)
173
+ // //# per configured table, using these table encryption configs.
174
+ // var m' := config.tableEncryptionConfigs;
175
+ // var mKeys := m'.Keys;
176
+ // var tableNamesSeq := SortedSets.ComputeSetToSequence(mKeys);
177
+ // ghost var mKeysSet := mKeys;
178
+
179
+ // ghost var inputConfigsModifies: set<object> := set
180
+ // tableConfig <- config.tableEncryptionConfigs.Values,
181
+ // o <- (
182
+ // (if tableConfig.keyring.Some? then tableConfig.keyring.value.Modifies else {})
183
+ // + (if tableConfig.cmm.Some? then tableConfig.cmm.value.Modifies else {})
184
+ // + (if tableConfig.legacyOverride.Some? then tableConfig.legacyOverride.value.encryptor.Modifies else {})
185
+ // )
186
+ // :: o;
187
+
188
+ // var allLogicalTableNames := {};
189
+ // var i := 0;
190
+
191
+ // while i < |tableNamesSeq|
192
+ // invariant m'.Keys <= config.tableEncryptionConfigs.Keys
193
+ // invariant forall k <- m' :: m'[k] == config.tableEncryptionConfigs[k]
194
+ // invariant forall internalConfig <- internalConfigs.Values :: internalConfig.logicalTableName in allLogicalTableNames
195
+
196
+ // invariant CorrectlyTransferedStructure?(internalConfigs, config)
197
+ // invariant AllTableConfigsValid?(internalConfigs)
198
+ // invariant ValidConfig?(Config(internalConfigs))
199
+
200
+ // // invariant BiteMe(config)
201
+
202
+ // modifies inputConfigsModifies
203
+ // {
204
+ // var tableName: string := tableNamesSeq[i];
205
+
206
+ // var inputConfig := config.tableEncryptionConfigs[tableName];
207
+ // :- Need(inputConfig.logicalTableName !in allLogicalTableNames, E("Duplicate logical table maped to multipule physical tables: " + inputConfig.logicalTableName));
208
+
209
+ // assert SearchConfigToInfo.ValidSearchConfig(inputConfig.search) by {
210
+ // assert ValidWholeSearchConfig(config);
211
+ // assert inputConfig in config.tableEncryptionConfigs.Values;
212
+ // }
213
+ // }
214
+ // }
215
+
216
+ method {:vcs_split_on_every_assert} {:only} DynamoDbEncryptionTransforms (config: AwsCryptographyDbEncryptionSdkDynamoDbTypes .DynamoDbTablesEncryptionConfig)
152
217
returns (res: Result< DynamoDbEncryptionTransformsClient, Error> )
153
218
// = specification/dynamodb-encryption-client/ddb-table-encryption-config.md#logical-table-name
154
219
// = type=implication
@@ -196,7 +261,7 @@ module
196
261
invariant AllTableConfigsValid?(internalConfigs)
197
262
invariant ValidConfig?(Config (internalConfigs))
198
263
199
- // invariant BiteMe (config)
264
+ invariant ValidWholeSearchConfig (config)
200
265
201
266
modifies inputConfigsModifies
202
267
{
@@ -282,6 +347,7 @@ module
282
347
}
283
348
284
349
i := i + 1;
350
+ assert SearchConfigToInfo. ValidSearchConfig (inputConfig.search);
285
351
}
286
352
assert SearchValidState (DdbMiddlewareConfig.Config(tableEncryptionConfigs := internalConfigs));
287
353
0 commit comments