Skip to content

Commit 2b6782e

Browse files
authored
CSHARP-5660: Sync auto encryption tests for QE text (#1765)
1 parent 56351e8 commit 2b6782e

18 files changed

+2938
-21
lines changed

purls.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pkg:github/mongodb/libmongocrypt@1.13.0
1+
pkg:github/mongodb/libmongocrypt@1.15.1

sbom.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
22
"components": [
33
{
4-
"bom-ref": "pkg:github/mongodb/libmongocrypt@1.13.0",
4+
"bom-ref": "pkg:github/mongodb/libmongocrypt@1.15.1",
55
"externalReferences": [
66
{
77
"type": "distribution",
8-
"url": "https://github.com/mongodb/libmongocrypt/archive/refs/tags/1.13.0.tar.gz"
8+
"url": "https://github.com/mongodb/libmongocrypt/archive/1.15.1.tar.gz"
99
},
1010
{
1111
"type": "website",
12-
"url": "https://github.com/mongodb/libmongocrypt/tree/1.13.0"
12+
"url": "https://github.com/mongodb/libmongocrypt/tree/1.15.1"
1313
}
1414
],
1515
"group": "mongodb",
1616
"name": "libmongocrypt",
17-
"purl": "pkg:github/mongodb/libmongocrypt@1.13.0",
17+
"purl": "pkg:github/mongodb/libmongocrypt@1.15.1",
1818
"type": "library",
19-
"version": "1.13.0"
19+
"version": "1.15.1"
2020
}
2121
],
2222
"dependencies": [
2323
{
24-
"ref": "pkg:github/mongodb/libmongocrypt@1.13.0"
24+
"ref": "pkg:github/mongodb/libmongocrypt@1.15.1"
2525
}
2626
],
2727
"metadata": {
28-
"timestamp": "2025-02-27T17:40:47.367492+00:00",
28+
"timestamp": "2025-08-27T19:31:06.459222+00:00",
2929
"tools": [
3030
{
3131
"externalReferences": [
@@ -68,7 +68,7 @@
6868
}
6969
]
7070
},
71-
"serialNumber": "urn:uuid:03b0f88b-8efc-4e12-9853-00b138b64e67",
71+
"serialNumber": "urn:uuid:a24dfa6a-26a8-44d8-94bd-a2488e01185b",
7272
"version": 1,
7373
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
7474
"bomFormat": "CycloneDX",
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
{
2+
"description": "QE-Text-cleanupStructuredEncryptionData",
3+
"schemaVersion": "1.25",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "8.2.0",
7+
"topologies": [
8+
"replicaset",
9+
"sharded",
10+
"load-balanced"
11+
],
12+
"csfle": {
13+
"minLibmongocryptVersion": "1.15.0"
14+
}
15+
}
16+
],
17+
"createEntities": [
18+
{
19+
"client": {
20+
"id": "client",
21+
"autoEncryptOpts": {
22+
"keyVaultNamespace": "keyvault.datakeys",
23+
"kmsProviders": {
24+
"local": {
25+
"key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk"
26+
}
27+
}
28+
},
29+
"observeEvents": [
30+
"commandStartedEvent"
31+
]
32+
}
33+
},
34+
{
35+
"database": {
36+
"id": "db",
37+
"client": "client",
38+
"databaseName": "db"
39+
}
40+
},
41+
{
42+
"collection": {
43+
"id": "coll",
44+
"database": "db",
45+
"collectionName": "coll"
46+
}
47+
}
48+
],
49+
"initialData": [
50+
{
51+
"databaseName": "keyvault",
52+
"collectionName": "datakeys",
53+
"documents": [
54+
{
55+
"_id": {
56+
"$binary": {
57+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
58+
"subType": "04"
59+
}
60+
},
61+
"keyMaterial": {
62+
"$binary": {
63+
"base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==",
64+
"subType": "00"
65+
}
66+
},
67+
"creationDate": {
68+
"$date": {
69+
"$numberLong": "1648914851981"
70+
}
71+
},
72+
"updateDate": {
73+
"$date": {
74+
"$numberLong": "1648914851981"
75+
}
76+
},
77+
"status": {
78+
"$numberInt": "0"
79+
},
80+
"masterKey": {
81+
"provider": "local"
82+
}
83+
}
84+
]
85+
},
86+
{
87+
"databaseName": "db",
88+
"collectionName": "coll",
89+
"documents": [],
90+
"createOptions": {
91+
"encryptedFields": {
92+
"fields": [
93+
{
94+
"keyId": {
95+
"$binary": {
96+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
97+
"subType": "04"
98+
}
99+
},
100+
"path": "encryptedText",
101+
"bsonType": "string",
102+
"queries": [
103+
{
104+
"queryType": "suffixPreview",
105+
"contention": {
106+
"$numberLong": "0"
107+
},
108+
"strMinQueryLength": {
109+
"$numberLong": "3"
110+
},
111+
"strMaxQueryLength": {
112+
"$numberLong": "30"
113+
},
114+
"caseSensitive": true,
115+
"diacriticSensitive": true
116+
}
117+
]
118+
}
119+
]
120+
}
121+
}
122+
}
123+
],
124+
"tests": [
125+
{
126+
"description": "QE Text cleanupStructuredEncryptionData works",
127+
"operations": [
128+
{
129+
"name": "runCommand",
130+
"object": "db",
131+
"arguments": {
132+
"command": {
133+
"cleanupStructuredEncryptionData": "coll"
134+
},
135+
"commandName": "cleanupStructuredEncryptionData"
136+
},
137+
"expectResult": {
138+
"ok": 1
139+
}
140+
}
141+
],
142+
"expectEvents": [
143+
{
144+
"client": "client",
145+
"events": [
146+
{
147+
"commandStartedEvent": {
148+
"command": {
149+
"listCollections": 1,
150+
"filter": {
151+
"name": "coll"
152+
}
153+
},
154+
"commandName": "listCollections"
155+
}
156+
},
157+
{
158+
"commandStartedEvent": {
159+
"command": {
160+
"find": "datakeys",
161+
"filter": {
162+
"$or": [
163+
{
164+
"_id": {
165+
"$in": [
166+
{
167+
"$binary": {
168+
"base64": "q83vqxI0mHYSNBI0VniQEg==",
169+
"subType": "04"
170+
}
171+
}
172+
]
173+
}
174+
},
175+
{
176+
"keyAltNames": {
177+
"$in": []
178+
}
179+
}
180+
]
181+
},
182+
"$db": "keyvault",
183+
"readConcern": {
184+
"level": "majority"
185+
}
186+
},
187+
"commandName": "find"
188+
}
189+
},
190+
{
191+
"commandStartedEvent": {
192+
"command": {
193+
"cleanupStructuredEncryptionData": "coll",
194+
"cleanupTokens": {
195+
"encryptedText": {
196+
"ecoc": {
197+
"$binary": {
198+
"base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=",
199+
"subType": "00"
200+
}
201+
},
202+
"anchorPaddingToken": {
203+
"$binary": {
204+
"base64": "YAiF7Iwhqq1UyfxPvm70xfQJtrIRPrjfD2yRLG1+saQ=",
205+
"subType": "00"
206+
}
207+
}
208+
}
209+
}
210+
},
211+
"commandName": "cleanupStructuredEncryptionData"
212+
}
213+
}
214+
]
215+
}
216+
]
217+
}
218+
]
219+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
description: QE-Text-cleanupStructuredEncryptionData
2+
schemaVersion: "1.25"
3+
runOnRequirements:
4+
- minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries.
5+
topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone.
6+
csfle:
7+
minLibmongocryptVersion: 1.15.0 # For SPM-4158.
8+
createEntities:
9+
- client:
10+
id: &client "client"
11+
autoEncryptOpts:
12+
keyVaultNamespace: keyvault.datakeys
13+
kmsProviders:
14+
local:
15+
key: Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk
16+
observeEvents:
17+
- commandStartedEvent
18+
- database:
19+
id: &db "db"
20+
client: *client
21+
databaseName: *db
22+
- collection:
23+
id: &coll "coll"
24+
database: *db
25+
collectionName: *coll
26+
initialData:
27+
# Insert data encryption key:
28+
- databaseName: keyvault
29+
collectionName: datakeys
30+
documents:
31+
[
32+
{
33+
"_id": &keyid { "$binary": { "base64": "q83vqxI0mHYSNBI0VniQEg==", "subType": "04" } },
34+
"keyMaterial":
35+
{
36+
"$binary":
37+
{
38+
"base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==",
39+
"subType": "00",
40+
},
41+
},
42+
"creationDate": { "$date": { "$numberLong": "1648914851981" } },
43+
"updateDate": { "$date": { "$numberLong": "1648914851981" } },
44+
"status": { "$numberInt": "0" },
45+
"masterKey": { "provider": "local" },
46+
},
47+
]
48+
# Create encrypted collection:
49+
- databaseName: *db
50+
collectionName: *coll
51+
documents: []
52+
createOptions:
53+
encryptedFields:
54+
{
55+
"fields":
56+
[
57+
{
58+
"keyId": *keyid,
59+
"path": "encryptedText",
60+
"bsonType": "string",
61+
"queries": [
62+
{
63+
"queryType": "suffixPreview",
64+
"contention": { "$numberLong": "0" },
65+
"strMinQueryLength": { "$numberLong": "3" },
66+
"strMaxQueryLength": { "$numberLong": "30" },
67+
"caseSensitive": true,
68+
"diacriticSensitive": true,
69+
},
70+
],
71+
},
72+
],
73+
}
74+
tests:
75+
- description: "QE Text cleanupStructuredEncryptionData works"
76+
operations:
77+
- name: runCommand
78+
object: *db
79+
arguments:
80+
command:
81+
cleanupStructuredEncryptionData: *coll
82+
commandName: cleanupStructuredEncryptionData
83+
expectResult: { ok: 1 }
84+
expectEvents:
85+
- client: *client
86+
events:
87+
- commandStartedEvent:
88+
command:
89+
listCollections: 1
90+
filter:
91+
name: *coll
92+
commandName: listCollections
93+
- commandStartedEvent:
94+
command:
95+
find: datakeys
96+
filter:
97+
{
98+
"$or":
99+
[
100+
"_id": { "$in": [ *keyid ] },
101+
"keyAltNames": { "$in": [] },
102+
],
103+
}
104+
$db: keyvault
105+
readConcern: { level: "majority" }
106+
commandName: find
107+
- commandStartedEvent:
108+
command:
109+
{
110+
"cleanupStructuredEncryptionData": *coll,
111+
"cleanupTokens": {
112+
"encryptedText": {
113+
"ecoc": {
114+
"$binary": {
115+
"base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=",
116+
"subType": "00"
117+
}
118+
},
119+
"anchorPaddingToken": {
120+
"$binary": {
121+
"base64": "YAiF7Iwhqq1UyfxPvm70xfQJtrIRPrjfD2yRLG1+saQ=",
122+
"subType": "00"
123+
}
124+
}
125+
}
126+
}
127+
}
128+
commandName: cleanupStructuredEncryptionData

0 commit comments

Comments
 (0)