mongo 2.18.0.beta1 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/mongo/bulk_write.rb +8 -2
  4. data/lib/mongo/client.rb +19 -5
  5. data/lib/mongo/client_encryption.rb +86 -4
  6. data/lib/mongo/cluster.rb +6 -4
  7. data/lib/mongo/collection/view/aggregation.rb +3 -0
  8. data/lib/mongo/collection/view/change_stream.rb +9 -0
  9. data/lib/mongo/collection/view/iterable.rb +1 -0
  10. data/lib/mongo/collection/view/readable.rb +11 -3
  11. data/lib/mongo/collection.rb +9 -1
  12. data/lib/mongo/config.rb +11 -0
  13. data/lib/mongo/crypt/auto_encrypter.rb +49 -21
  14. data/lib/mongo/crypt/binding.rb +73 -48
  15. data/lib/mongo/crypt/data_key_context.rb +6 -1
  16. data/lib/mongo/crypt/encryption_io.rb +66 -0
  17. data/lib/mongo/crypt/explicit_encrypter.rb +116 -5
  18. data/lib/mongo/crypt/explicit_encryption_context.rb +3 -8
  19. data/lib/mongo/crypt/handle.rb +26 -8
  20. data/lib/mongo/crypt/kms/aws.rb +11 -3
  21. data/lib/mongo/crypt/kms/azure.rb +14 -6
  22. data/lib/mongo/crypt/kms/gcp.rb +12 -5
  23. data/lib/mongo/crypt/kms/kmip.rb +15 -9
  24. data/lib/mongo/crypt/kms/local.rb +9 -1
  25. data/lib/mongo/crypt/kms/master_key_document.rb +1 -1
  26. data/lib/mongo/crypt/rewrap_many_data_key_context.rb +46 -0
  27. data/lib/mongo/crypt/rewrap_many_data_key_result.rb +37 -0
  28. data/lib/mongo/crypt/status.rb +8 -2
  29. data/lib/mongo/crypt.rb +2 -0
  30. data/lib/mongo/database.rb +10 -27
  31. data/lib/mongo/error/missing_file_chunk.rb +8 -2
  32. data/lib/mongo/grid/stream/read.rb +6 -0
  33. data/lib/mongo/index/view.rb +1 -0
  34. data/lib/mongo/operation/create/op_msg.rb +1 -13
  35. data/lib/mongo/operation/distinct/op_msg.rb +4 -1
  36. data/lib/mongo/protocol/msg.rb +0 -16
  37. data/lib/mongo/server/connection_pool.rb +5 -4
  38. data/lib/mongo/server/monitor/connection.rb +10 -4
  39. data/lib/mongo/server/monitor.rb +4 -0
  40. data/lib/mongo/server/push_monitor.rb +4 -0
  41. data/lib/mongo/version.rb +1 -1
  42. data/lib/mongo.rb +2 -0
  43. data/spec/README.md +14 -0
  44. data/spec/integration/change_stream_spec.rb +1 -1
  45. data/spec/integration/client_construction_spec.rb +73 -7
  46. data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +165 -164
  47. data/spec/integration/client_side_encryption/decryption_events_prose_spec.rb +158 -0
  48. data/spec/integration/client_side_encryption/explicit_queryable_encryption_spec.rb +5 -5
  49. data/spec/integration/client_side_encryption/kms_tls_options_spec.rb +50 -8
  50. data/spec/integration/client_side_encryption/unique_index_on_key_alt_names_prose_spec.rb +85 -0
  51. data/spec/integration/ocsp_verifier_spec.rb +1 -1
  52. data/spec/integration/reconnect_spec.rb +2 -0
  53. data/spec/integration/sdam_events_spec.rb +40 -0
  54. data/spec/integration/srv_monitoring_spec.rb +1 -0
  55. data/spec/integration/srv_spec.rb +1 -0
  56. data/spec/lite_spec_helper.rb +5 -4
  57. data/spec/mongo/bulk_write_spec.rb +13 -0
  58. data/spec/mongo/client_construction_spec.rb +45 -2
  59. data/spec/mongo/client_encryption_spec.rb +0 -12
  60. data/spec/mongo/client_spec.rb +1 -1
  61. data/spec/mongo/collection/view/aggregation_spec.rb +119 -0
  62. data/spec/mongo/collection/view/readable_spec.rb +630 -5
  63. data/spec/mongo/collection_spec.rb +32 -0
  64. data/spec/mongo/crypt/auto_encrypter_spec.rb +110 -0
  65. data/spec/mongo/crypt/binding/context_spec.rb +3 -35
  66. data/spec/mongo/crypt/data_key_context_spec.rb +1 -1
  67. data/spec/mongo/crypt/explicit_encryption_context_spec.rb +8 -3
  68. data/spec/mongo/crypt/handle_spec.rb +39 -3
  69. data/spec/mongo/crypt/kms/credentials_spec.rb +0 -47
  70. data/spec/mongo/index/view_spec.rb +56 -0
  71. data/spec/mongo/operation/create/op_msg_spec.rb +0 -42
  72. data/spec/mongo/server/connection_pool_spec.rb +26 -4
  73. data/spec/mongo/socket/ssl_spec.rb +3 -3
  74. data/spec/runners/crud/requirement.rb +6 -1
  75. data/spec/runners/crud/test.rb +1 -1
  76. data/spec/runners/transactions/spec.rb +2 -2
  77. data/spec/runners/transactions/test.rb +4 -20
  78. data/spec/runners/transactions.rb +2 -2
  79. data/spec/runners/unified/assertions.rb +32 -2
  80. data/spec/runners/unified/change_stream_operations.rb +3 -0
  81. data/spec/runners/unified/client_side_encryption_operations.rb +83 -0
  82. data/spec/runners/unified/crud_operations.rb +17 -2
  83. data/spec/runners/unified/ddl_operations.rb +27 -2
  84. data/spec/runners/unified/grid_fs_operations.rb +21 -0
  85. data/spec/runners/unified/test.rb +59 -1
  86. data/spec/shared/lib/mrss/docker_runner.rb +2 -0
  87. data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
  88. data/spec/shared/lib/mrss/lite_constraints.rb +10 -2
  89. data/spec/shared/shlib/set_env.sh +3 -0
  90. data/spec/solo/clean_exit_spec.rb +5 -0
  91. data/spec/spec_tests/client_side_encryption_spec.rb +1 -1
  92. data/spec/spec_tests/client_side_encryption_unified_spec.rb +16 -0
  93. data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +298 -0
  94. data/spec/spec_tests/data/client_side_encryption/create-and-createIndexes.yml +58 -0
  95. data/spec/spec_tests/data/client_side_encryption/fle2-Delete.yml +1 -1
  96. data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-jsonSchema.yml +1 -1
  97. data/spec/spec_tests/data/client_side_encryption/fle2-FindOneAndUpdate.yml +2 -2
  98. data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Indexed.yml +1 -1
  99. data/spec/spec_tests/data/client_side_encryption/fle2-Update.yml +2 -2
  100. data/spec/spec_tests/data/client_side_encryption/unified/addKeyAltName.yml +194 -0
  101. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey-kms_providers-invalid.yml +67 -0
  102. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey.yml +309 -0
  103. data/spec/spec_tests/data/client_side_encryption/unified/deleteKey.yml +159 -0
  104. data/spec/spec_tests/data/client_side_encryption/unified/getKey.yml +105 -0
  105. data/spec/spec_tests/data/client_side_encryption/unified/getKeyByAltName.yml +104 -0
  106. data/spec/spec_tests/data/client_side_encryption/unified/getKeys.yml +122 -0
  107. data/spec/spec_tests/data/client_side_encryption/unified/removeKeyAltName.yml +157 -0
  108. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-decrypt_failure.yml +69 -0
  109. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-encrypt_failure.yml +122 -0
  110. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +432 -0
  111. data/spec/spec_tests/data/client_side_encryption/validatorAndPartialFieldExpression.yml +166 -0
  112. data/spec/spec_tests/data/command_monitoring_unified/bulkWrite.yml +68 -0
  113. data/spec/spec_tests/data/command_monitoring_unified/command.yml +50 -0
  114. data/spec/spec_tests/data/command_monitoring_unified/deleteMany.yml +79 -0
  115. data/spec/spec_tests/data/command_monitoring_unified/deleteOne.yml +79 -0
  116. data/spec/spec_tests/data/command_monitoring_unified/find.yml +254 -0
  117. data/spec/spec_tests/data/command_monitoring_unified/insertMany.yml +79 -0
  118. data/spec/spec_tests/data/command_monitoring_unified/insertOne.yml +77 -0
  119. data/spec/spec_tests/data/command_monitoring_unified/unacknowledgedBulkWrite.yml +55 -0
  120. data/spec/spec_tests/data/command_monitoring_unified/updateMany.yml +87 -0
  121. data/spec/spec_tests/data/command_monitoring_unified/updateOne.yml +118 -0
  122. data/spec/spec_tests/data/crud_unified/distinct-comment.yml +98 -0
  123. data/spec/spec_tests/data/gridfs_unified/delete.yml +198 -0
  124. data/spec/spec_tests/data/gridfs_unified/download.yml +241 -0
  125. data/spec/spec_tests/data/gridfs_unified/downloadByName.yml +159 -0
  126. data/spec/spec_tests/data/gridfs_unified/upload-disableMD5.yml +92 -0
  127. data/spec/spec_tests/data/gridfs_unified/upload.yml +288 -0
  128. data/spec/spec_tests/gridfs_unified_spec.rb +13 -0
  129. data/spec/stress/connection_pool_timing_spec.rb +2 -2
  130. data/spec/support/background_thread_registry.rb +3 -13
  131. data/spec/support/certificates/atlas-ocsp-ca.crt +40 -47
  132. data/spec/support/certificates/atlas-ocsp.crt +101 -106
  133. data/spec/support/crypt.rb +57 -13
  134. data/spec/support/macros.rb +10 -0
  135. data/spec/support/spec_config.rb +4 -0
  136. data.tar.gz.sig +0 -0
  137. metadata +1271 -1219
  138. metadata.gz.sig +0 -0
  139. data/spec/spec_tests/command_monitoring_spec.rb +0 -71
  140. data/spec/spec_tests/data/command_monitoring/bulkWrite.yml +0 -49
  141. data/spec/spec_tests/data/command_monitoring/command.yml +0 -61
  142. data/spec/spec_tests/data/command_monitoring/deleteMany.yml +0 -55
  143. data/spec/spec_tests/data/command_monitoring/deleteOne.yml +0 -55
  144. data/spec/spec_tests/data/command_monitoring/find.yml +0 -266
  145. data/spec/spec_tests/data/command_monitoring/insertMany.yml +0 -75
  146. data/spec/spec_tests/data/command_monitoring/insertOne.yml +0 -51
  147. data/spec/spec_tests/data/command_monitoring/unacknowledgedBulkWrite.yml +0 -34
  148. data/spec/spec_tests/data/command_monitoring/updateMany.yml +0 -65
  149. data/spec/spec_tests/data/command_monitoring/updateOne.yml +0 -90
@@ -0,0 +1,309 @@
1
+ description: createDataKey
2
+
3
+ schemaVersion: "1.8"
4
+
5
+ runOnRequirements:
6
+ - csfle: true
7
+
8
+ createEntities:
9
+ - client:
10
+ id: &client0 client0
11
+ observeEvents:
12
+ - commandStartedEvent
13
+ - clientEncryption:
14
+ id: &clientEncryption0 clientEncryption0
15
+ clientEncryptionOpts:
16
+ keyVaultClient: *client0
17
+ keyVaultNamespace: keyvault.datakeys
18
+ kmsProviders:
19
+ aws: { accessKeyId: { $$placeholder: 1 }, secretAccessKey: { $$placeholder: 1 } }
20
+ azure: { tenantId: { $$placeholder: 1 }, clientId: { $$placeholder: 1 }, clientSecret: { $$placeholder: 1 } }
21
+ gcp: { email: { $$placeholder: 1 }, privateKey: { $$placeholder: 1 } }
22
+ kmip: { endpoint: { $$placeholder: 1 } }
23
+ local: { key: { $$placeholder: 1 } }
24
+ - database:
25
+ id: &database0 database0
26
+ client: *client0
27
+ databaseName: &database0Name keyvault
28
+ - collection:
29
+ id: &collection0 collection0
30
+ database: *database0
31
+ collectionName: &collection0Name datakeys
32
+
33
+ initialData:
34
+ - databaseName: *database0Name
35
+ collectionName: *collection0Name
36
+ documents: []
37
+
38
+ tests:
39
+ - description: create data key with AWS KMS provider
40
+ operations:
41
+ - name: createDataKey
42
+ object: *clientEncryption0
43
+ arguments:
44
+ kmsProvider: aws
45
+ opts:
46
+ masterKey: &new_aws_masterkey
47
+ key: arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0
48
+ region: us-east-1
49
+ expectResult: { $$type: binData }
50
+ expectEvents:
51
+ - client: *client0
52
+ events:
53
+ - commandStartedEvent:
54
+ databaseName: *database0Name
55
+ command:
56
+ insert: *collection0Name
57
+ documents:
58
+ - _id: { $$type: binData }
59
+ keyMaterial: { $$type: binData }
60
+ creationDate: { $$type: date }
61
+ updateDate: { $$type: date }
62
+ status: { $$exists: true }
63
+ masterKey:
64
+ provider: aws
65
+ <<: *new_aws_masterkey
66
+ writeConcern: { w: majority }
67
+
68
+ - description: create datakey with Azure KMS provider
69
+ operations:
70
+ - name: createDataKey
71
+ object: *clientEncryption0
72
+ arguments:
73
+ kmsProvider: azure
74
+ opts:
75
+ masterKey: &new_azure_masterkey
76
+ keyVaultEndpoint: key-vault-csfle.vault.azure.net
77
+ keyName: key-name-csfle
78
+ expectResult: { $$type: binData }
79
+ expectEvents:
80
+ - client: *client0
81
+ events:
82
+ - commandStartedEvent:
83
+ databaseName: *database0Name
84
+ command:
85
+ insert: *collection0Name
86
+ documents:
87
+ - _id: { $$type: binData }
88
+ keyMaterial: { $$type: binData }
89
+ creationDate: { $$type: date }
90
+ updateDate: { $$type: date }
91
+ status: { $$exists: true }
92
+ masterKey:
93
+ provider: azure
94
+ <<: *new_azure_masterkey
95
+ writeConcern: { w: majority }
96
+
97
+ - description: create datakey with GCP KMS provider
98
+ operations:
99
+ - name: createDataKey
100
+ object: *clientEncryption0
101
+ arguments:
102
+ kmsProvider: gcp
103
+ opts:
104
+ masterKey: &new_gcp_masterkey
105
+ projectId: devprod-drivers
106
+ location: global
107
+ keyRing: key-ring-csfle
108
+ keyName: key-name-csfle
109
+ expectResult: { $$type: binData }
110
+ expectEvents:
111
+ - client: *client0
112
+ events:
113
+ - commandStartedEvent:
114
+ databaseName: *database0Name
115
+ command:
116
+ insert: *collection0Name
117
+ documents:
118
+ - _id: { $$type: binData }
119
+ keyMaterial: { $$type: binData }
120
+ creationDate: { $$type: date }
121
+ updateDate: { $$type: date }
122
+ status: { $$exists: true }
123
+ masterKey:
124
+ provider: gcp
125
+ <<: *new_gcp_masterkey
126
+ writeConcern: { w: majority }
127
+
128
+ - description: create datakey with KMIP KMS provider
129
+ operations:
130
+ - name: createDataKey
131
+ object: *clientEncryption0
132
+ arguments:
133
+ kmsProvider: kmip
134
+ expectResult: { $$type: binData }
135
+ expectEvents:
136
+ - client: *client0
137
+ events:
138
+ - commandStartedEvent:
139
+ databaseName: *database0Name
140
+ command:
141
+ insert: *collection0Name
142
+ documents:
143
+ - _id: { $$type: binData }
144
+ keyMaterial: { $$type: binData }
145
+ creationDate: { $$type: date }
146
+ updateDate: { $$type: date }
147
+ status: { $$exists: true }
148
+ masterKey:
149
+ provider: kmip
150
+ keyId: { $$type: string }
151
+ writeConcern: { w: majority }
152
+
153
+ - description: create datakey with local KMS provider
154
+ operations:
155
+ - name: createDataKey
156
+ object: *clientEncryption0
157
+ arguments:
158
+ kmsProvider: local
159
+ expectResult: { $$type: binData }
160
+ expectEvents:
161
+ - client: *client0
162
+ events:
163
+ - commandStartedEvent:
164
+ databaseName: *database0Name
165
+ command:
166
+ insert: *collection0Name
167
+ documents:
168
+ - _id: { $$type: binData }
169
+ keyMaterial: { $$type: binData }
170
+ creationDate: { $$type: date }
171
+ updateDate: { $$type: date }
172
+ status: { $$exists: true }
173
+ masterKey:
174
+ provider: local
175
+ writeConcern: { w: majority }
176
+
177
+ - description: create datakey with no keyAltName
178
+ operations:
179
+ - name: createDataKey
180
+ object: *clientEncryption0
181
+ arguments:
182
+ kmsProvider: local
183
+ opts:
184
+ keyAltNames: []
185
+ expectResult: { $$type: binData }
186
+ expectEvents:
187
+ - client: *client0
188
+ events:
189
+ - commandStartedEvent:
190
+ databaseName: *database0Name
191
+ command:
192
+ insert: *collection0Name
193
+ documents:
194
+ - _id: { $$type: binData }
195
+ # keyAltNames field should not exist if no keyAltNames are given.
196
+ keyAltNames: { $$exists: false }
197
+ keyMaterial: { $$type: binData }
198
+ creationDate: { $$type: date }
199
+ updateDate: { $$type: date }
200
+ status: { $$type: int }
201
+ masterKey: { $$type: object }
202
+ writeConcern: { w: majority }
203
+
204
+ - description: create datakey with single keyAltName
205
+ operations:
206
+ - name: createDataKey
207
+ object: *clientEncryption0
208
+ arguments:
209
+ kmsProvider: local
210
+ opts:
211
+ keyAltNames: ["local_key"]
212
+ expectResult: { $$type: binData }
213
+ expectEvents:
214
+ - client: *client0
215
+ events:
216
+ - commandStartedEvent:
217
+ databaseName: *database0Name
218
+ command:
219
+ insert: *collection0Name
220
+ documents:
221
+ - _id: { $$type: binData }
222
+ keyAltNames: [local_key]
223
+ keyMaterial: { $$type: binData }
224
+ creationDate: { $$type: date }
225
+ updateDate: { $$type: date }
226
+ status: { $$type: int }
227
+ masterKey: { $$type: object }
228
+ writeConcern: { w: majority }
229
+
230
+ - description: create datakey with multiple keyAltNames
231
+ operations:
232
+ - name: createDataKey
233
+ object: *clientEncryption0
234
+ arguments:
235
+ kmsProvider: local
236
+ opts:
237
+ keyAltNames: ["abc", "def"]
238
+ expectResult: { $$type: binData }
239
+ - name: aggregate
240
+ object: *collection0
241
+ arguments:
242
+ # Need to use pipeline to sort keyAltNames for deterministic matching
243
+ # because keyAltNames is not required to be sorted.
244
+ pipeline:
245
+ - $project: { _id: 0, keyAltNames: 1 }
246
+ - $unwind: $keyAltNames
247
+ - $sort: { keyAltNames: 1 }
248
+ expectResult:
249
+ - keyAltNames: abc
250
+ - keyAltNames: def
251
+ expectEvents:
252
+ - client: *client0
253
+ events:
254
+ - commandStartedEvent:
255
+ databaseName: *database0Name
256
+ command:
257
+ insert: *collection0Name
258
+ documents:
259
+ - _id: { $$type: binData }
260
+ keyAltNames: { $$type: array }
261
+ keyMaterial: { $$type: binData }
262
+ creationDate: { $$type: date }
263
+ updateDate: { $$type: date }
264
+ status: { $$type: int }
265
+ masterKey: { $$type: object }
266
+ writeConcern: { w: majority }
267
+ - commandStartedEvent: { commandName: aggregate }
268
+
269
+ - description: create datakey with custom key material
270
+ operations:
271
+ - name: createDataKey
272
+ object: *clientEncryption0
273
+ arguments:
274
+ kmsProvider: local
275
+ opts:
276
+ # "key_material" repeated 8 times.
277
+ keyMaterial: &custom_key_material { $binary: { base64: a2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFs, subType: "00" } }
278
+ expectResult: { $$type: binData }
279
+ expectEvents:
280
+ - client: *client0
281
+ events:
282
+ - commandStartedEvent:
283
+ databaseName: *database0Name
284
+ command:
285
+ insert: *collection0Name
286
+ documents:
287
+ - _id: { $$type: binData }
288
+ # Cannot match exact value of encrypted key material.
289
+ keyMaterial: { $$type: binData }
290
+ creationDate: { $$type: date }
291
+ updateDate: { $$type: date }
292
+ status: { $$type: int }
293
+ masterKey: { $$type: object }
294
+ writeConcern: { w: majority }
295
+
296
+ - description: create datakey with invalid custom key material (too short)
297
+ operations:
298
+ - name: createDataKey
299
+ object: *clientEncryption0
300
+ arguments:
301
+ kmsProvider: local
302
+ opts:
303
+ # "key_material" repeated only 7 times (key material length == 84).
304
+ keyMaterial: { $binary: { base64: a2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFs, subType: "00" } }
305
+ expectError:
306
+ isClientError: true
307
+ expectEvents:
308
+ - client: *client0
309
+ events: []
@@ -0,0 +1,159 @@
1
+ description: deleteKey
2
+
3
+ schemaVersion: "1.8"
4
+
5
+ runOnRequirements:
6
+ - csfle: true
7
+
8
+ createEntities:
9
+ - client:
10
+ id: &client0 client0
11
+ observeEvents:
12
+ - commandStartedEvent
13
+ - clientEncryption:
14
+ id: &clientEncryption0 clientEncryption0
15
+ clientEncryptionOpts:
16
+ keyVaultClient: *client0
17
+ keyVaultNamespace: keyvault.datakeys
18
+ kmsProviders:
19
+ local: { key: { $$placeholder: 1 } }
20
+ - database:
21
+ id: &database0 database0
22
+ client: *client0
23
+ databaseName: &database0Name keyvault
24
+ - collection:
25
+ id: &collection0 collection0
26
+ database: *database0
27
+ collectionName: &collection0Name datakeys
28
+
29
+ initialData:
30
+ - databaseName: *database0Name
31
+ collectionName: *collection0Name
32
+ documents:
33
+ - &aws_key_doc
34
+ _id: &aws_key_id { $binary: { base64: YXdzYXdzYXdzYXdzYXdzYQ==, subType: "04" } }
35
+ keyAltNames: ["aws_key"]
36
+ keyMaterial: { $binary: { base64: AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L, subType: "00" } }
37
+ creationDate: { $date: { $numberLong: "1641024000000" } }
38
+ updateDate: { $date: { $numberLong: "1641024000000" } }
39
+ status: 1
40
+ masterKey:
41
+ provider: aws
42
+ key: arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0
43
+ region: us-east-1
44
+ - &local_key_doc
45
+ _id: &local_key_id { $binary: { base64: bG9jYWxrZXlsb2NhbGtleQ==, subType: "04" } }
46
+ keyAltNames: ["local_key"]
47
+ keyMaterial: { $binary: { base64: ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==, subType: "00" } }
48
+ creationDate: { $date: { $numberLong: "1641024000000" } }
49
+ updateDate: { $date: { $numberLong: "1641024000000" } }
50
+ status: 1
51
+ masterKey:
52
+ provider: local
53
+
54
+ tests:
55
+ - description: delete non-existent data key
56
+ operations:
57
+ - name: deleteKey
58
+ object: *clientEncryption0
59
+ arguments:
60
+ # *aws_key_id with first three letters replaced with 'A' (value: "3awsawsawsawsa").
61
+ id: &non_existent_id { $binary: { base64: AAAzYXdzYXdzYXdzYXdzYQ==, subType: "04" } }
62
+ expectResult:
63
+ deletedCount: 0
64
+ expectEvents:
65
+ - client: *client0
66
+ events:
67
+ - commandStartedEvent:
68
+ databaseName: *database0Name
69
+ command:
70
+ delete: *collection0Name
71
+ deletes: [{ q: { _id: *non_existent_id }, limit: 1 }]
72
+ writeConcern: { w: majority }
73
+ outcome:
74
+ - collectionName: *collection0Name
75
+ databaseName: *database0Name
76
+ documents:
77
+ - *aws_key_doc
78
+ - *local_key_doc
79
+
80
+ - description: delete existing AWS data key
81
+ operations:
82
+ - name: deleteKey
83
+ object: *clientEncryption0
84
+ arguments:
85
+ id: *aws_key_id
86
+ expectResult:
87
+ deletedCount: 1
88
+ expectEvents:
89
+ - client: *client0
90
+ events:
91
+ - commandStartedEvent:
92
+ databaseName: *database0Name
93
+ command:
94
+ delete: *collection0Name
95
+ deletes: [{ q: { _id: *aws_key_id }, limit: 1 }]
96
+ writeConcern: { w: majority }
97
+ outcome:
98
+ - collectionName: *collection0Name
99
+ databaseName: *database0Name
100
+ documents:
101
+ - *local_key_doc
102
+
103
+ - description: delete existing local data key
104
+ operations:
105
+ - name: deleteKey
106
+ object: *clientEncryption0
107
+ arguments:
108
+ id: *local_key_id
109
+ expectResult:
110
+ deletedCount: 1
111
+ expectEvents:
112
+ - client: *client0
113
+ events:
114
+ - commandStartedEvent:
115
+ databaseName: *database0Name
116
+ command:
117
+ delete: *collection0Name
118
+ deletes: [{ q: { _id: *local_key_id }, limit: 1 }]
119
+ writeConcern: { w: majority }
120
+ outcome:
121
+ - collectionName: *collection0Name
122
+ databaseName: *database0Name
123
+ documents:
124
+ - *aws_key_doc
125
+
126
+ - description: delete existing data key twice
127
+ operations:
128
+ - name: deleteKey
129
+ object: *clientEncryption0
130
+ arguments:
131
+ id: *aws_key_id
132
+ expectResult:
133
+ deletedCount: 1
134
+ - name: deleteKey
135
+ object: *clientEncryption0
136
+ arguments:
137
+ id: *aws_key_id
138
+ expectResult:
139
+ deletedCount: 0
140
+ expectEvents:
141
+ - client: *client0
142
+ events:
143
+ - commandStartedEvent:
144
+ databaseName: *database0Name
145
+ command:
146
+ delete: *collection0Name
147
+ deletes: [{ q: { _id: *aws_key_id }, limit: 1 }]
148
+ writeConcern: { w: majority }
149
+ - commandStartedEvent:
150
+ databaseName: *database0Name
151
+ command:
152
+ delete: *collection0Name
153
+ deletes: [{ q: { _id: *aws_key_id }, limit: 1 }]
154
+ writeConcern: { w: majority }
155
+ outcome:
156
+ - collectionName: *collection0Name
157
+ databaseName: *database0Name
158
+ documents:
159
+ - *local_key_doc
@@ -0,0 +1,105 @@
1
+ description: getKey
2
+
3
+ schemaVersion: "1.8"
4
+
5
+ runOnRequirements:
6
+ - csfle: true
7
+
8
+ createEntities:
9
+ - client:
10
+ id: &client0 client0
11
+ observeEvents:
12
+ - commandStartedEvent
13
+ - clientEncryption:
14
+ id: &clientEncryption0 clientEncryption0
15
+ clientEncryptionOpts:
16
+ keyVaultClient: *client0
17
+ keyVaultNamespace: keyvault.datakeys
18
+ kmsProviders:
19
+ local: { key: { $$placeholder: 1 } }
20
+ - database:
21
+ id: &database0 database0
22
+ client: *client0
23
+ databaseName: &database0Name keyvault
24
+ - collection:
25
+ id: &collection0 collection0
26
+ database: *database0
27
+ collectionName: &collection0Name datakeys
28
+
29
+ initialData:
30
+ - databaseName: *database0Name
31
+ collectionName: *collection0Name
32
+ documents:
33
+ - &aws_key_doc
34
+ _id: &aws_key_id { $binary: { base64: YXdzYXdzYXdzYXdzYXdzYQ==, subType: "04" } }
35
+ keyAltNames: ["aws_key"]
36
+ keyMaterial: { $binary: { base64: AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L, subType: "00" } }
37
+ creationDate: { $date: { $numberLong: "1641024000000" } }
38
+ updateDate: { $date: { $numberLong: "1641024000000" } }
39
+ status: 1
40
+ masterKey:
41
+ provider: aws
42
+ key: arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0
43
+ region: us-east-1
44
+ - &local_key_doc
45
+ _id: &local_key_id { $binary: { base64: bG9jYWxrZXlsb2NhbGtleQ==, subType: "04" } }
46
+ keyAltNames: ["local_key"]
47
+ keyMaterial: { $binary: { base64: ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==, subType: "00" } }
48
+ creationDate: { $date: { $numberLong: "1641024000000" } }
49
+ updateDate: { $date: { $numberLong: "1641024000000" } }
50
+ status: 1
51
+ masterKey:
52
+ provider: local
53
+
54
+ tests:
55
+ - description: get non-existent data key
56
+ operations:
57
+ - name: getKey
58
+ object: *clientEncryption0
59
+ arguments:
60
+ # *aws_key_id with first three letters replaced with 'A' (value: "3awsawsawsawsa").
61
+ id: &non_existent_id { $binary: { base64: AAAzYXdzYXdzYXdzYXdzYQ==, subType: "04" } }
62
+ expectResult: { $$unsetOrMatches: null }
63
+ expectEvents:
64
+ - client: *client0
65
+ events:
66
+ - commandStartedEvent:
67
+ databaseName: *database0Name
68
+ command:
69
+ find: *collection0Name
70
+ filter: { _id: *non_existent_id }
71
+ readConcern: { level: majority }
72
+
73
+ - description: get existing AWS data key
74
+ operations:
75
+ - name: getKey
76
+ object: *clientEncryption0
77
+ arguments:
78
+ id: *aws_key_id
79
+ expectResult: *aws_key_doc
80
+ expectEvents:
81
+ - client: *client0
82
+ events:
83
+ - commandStartedEvent:
84
+ databaseName: *database0Name
85
+ command:
86
+ find: *collection0Name
87
+ filter: { _id: *aws_key_id }
88
+ readConcern: { level: majority }
89
+
90
+ - description: get existing local data key
91
+ operations:
92
+ - name: getKey
93
+ object: *clientEncryption0
94
+ arguments:
95
+ id: *local_key_id
96
+ expectResult: *local_key_doc
97
+ expectEvents:
98
+ - client: *client0
99
+ events:
100
+ - commandStartedEvent:
101
+ databaseName: *database0Name
102
+ command:
103
+ find: *collection0Name
104
+ filter: { _id: *local_key_id }
105
+ readConcern: { level: majority }
@@ -0,0 +1,104 @@
1
+ description: getKeyByAltName
2
+
3
+ schemaVersion: "1.8"
4
+
5
+ runOnRequirements:
6
+ - csfle: true
7
+
8
+ createEntities:
9
+ - client:
10
+ id: &client0 client0
11
+ observeEvents:
12
+ - commandStartedEvent
13
+ - clientEncryption:
14
+ id: &clientEncryption0 clientEncryption0
15
+ clientEncryptionOpts:
16
+ keyVaultClient: *client0
17
+ keyVaultNamespace: keyvault.datakeys
18
+ kmsProviders:
19
+ local: { key: { $$placeholder: 1 } }
20
+ - database:
21
+ id: &database0 database0
22
+ client: *client0
23
+ databaseName: &database0Name keyvault
24
+ - collection:
25
+ id: &collection0 collection0
26
+ database: *database0
27
+ collectionName: &collection0Name datakeys
28
+
29
+ initialData:
30
+ - databaseName: *database0Name
31
+ collectionName: *collection0Name
32
+ documents:
33
+ - &aws_key_doc
34
+ _id: { $binary: { base64: YXdzYXdzYXdzYXdzYXdzYQ==, subType: "04" } }
35
+ keyAltNames: ["aws_key"]
36
+ keyMaterial: { $binary: { base64: AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L, subType: "00" } }
37
+ creationDate: { $date: { $numberLong: "1641024000000" } }
38
+ updateDate: { $date: { $numberLong: "1641024000000" } }
39
+ status: 1
40
+ masterKey:
41
+ provider: aws
42
+ key: arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0
43
+ region: us-east-1
44
+ - &local_key_doc
45
+ _id: { $binary: { base64: bG9jYWxrZXlsb2NhbGtleQ==, subType: "04" } }
46
+ keyAltNames: ["local_key"]
47
+ keyMaterial: { $binary: { base64: ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==, subType: "00" } }
48
+ creationDate: { $date: { $numberLong: "1641024000000" } }
49
+ updateDate: { $date: { $numberLong: "1641024000000" } }
50
+ status: 1
51
+ masterKey:
52
+ provider: local
53
+
54
+ tests:
55
+ - description: get non-existent data key
56
+ operations:
57
+ - name: getKeyByAltName
58
+ object: *clientEncryption0
59
+ arguments:
60
+ keyAltName: does_not_exist
61
+ expectResult: { $$unsetOrMatches: null }
62
+ expectEvents:
63
+ - client: *client0
64
+ events:
65
+ - commandStartedEvent:
66
+ databaseName: *database0Name
67
+ command:
68
+ find: *collection0Name
69
+ filter: { keyAltNames: does_not_exist }
70
+ readConcern: { level: majority }
71
+
72
+ - description: get existing AWS data key
73
+ operations:
74
+ - name: getKeyByAltName
75
+ object: *clientEncryption0
76
+ arguments:
77
+ keyAltName: aws_key
78
+ expectResult: *aws_key_doc
79
+ expectEvents:
80
+ - client: *client0
81
+ events:
82
+ - commandStartedEvent:
83
+ databaseName: *database0Name
84
+ command:
85
+ find: *collection0Name
86
+ filter: { keyAltNames: aws_key }
87
+ readConcern: { level: majority }
88
+
89
+ - description: get existing local data key
90
+ operations:
91
+ - name: getKeyByAltName
92
+ object: *clientEncryption0
93
+ arguments:
94
+ keyAltName: local_key
95
+ expectResult: *local_key_doc
96
+ expectEvents:
97
+ - client: *client0
98
+ events:
99
+ - commandStartedEvent:
100
+ databaseName: *database0Name
101
+ command:
102
+ find: *collection0Name
103
+ filter: { keyAltNames: local_key }
104
+ readConcern: { level: majority }