diff --git a/.evergreen/spec-patch/PYTHON-5959.patch b/.evergreen/spec-patch/PYTHON-5959.patch new file mode 100644 index 0000000000..5acb1d2f76 --- /dev/null +++ b/.evergreen/spec-patch/PYTHON-5959.patch @@ -0,0 +1,1253 @@ +diff --git a/test/client-side-encryption/etc/data/encryptedFields-prefix-suffix-preview.json b/test/client-side-encryption/etc/data/encryptedFields-prefix-suffix-preview.json +new file mode 100644 +index 000000000..047064beb +--- /dev/null ++++ b/test/client-side-encryption/etc/data/encryptedFields-prefix-suffix-preview.json +@@ -0,0 +1,44 @@ ++{ ++ "fields": [ ++ { ++ "keyId": { ++ "$binary": { ++ "base64": "EjRWeBI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "path": "encryptedText", ++ "bsonType": "string", ++ "queries": [ ++ { ++ "queryType": "prefixPreview", ++ "strMinQueryLength": { ++ "$numberInt": "2" ++ }, ++ "strMaxQueryLength": { ++ "$numberInt": "10" ++ }, ++ "contention": { ++ "$numberLong": "0" ++ }, ++ "caseSensitive": true, ++ "diacriticSensitive": true ++ }, ++ { ++ "queryType": "suffixPreview", ++ "strMinQueryLength": { ++ "$numberInt": "2" ++ }, ++ "strMaxQueryLength": { ++ "$numberInt": "10" ++ }, ++ "contention": { ++ "$numberLong": "0" ++ }, ++ "caseSensitive": true, ++ "diacriticSensitive": true ++ } ++ ] ++ } ++ ] ++} +diff --git a/test/client-side-encryption/etc/data/encryptedFields-substring-preview.json b/test/client-side-encryption/etc/data/encryptedFields-substring-preview.json +new file mode 100644 +index 000000000..a519edc62 +--- /dev/null ++++ b/test/client-side-encryption/etc/data/encryptedFields-substring-preview.json +@@ -0,0 +1,33 @@ ++{ ++ "fields": [ ++ { ++ "keyId": { ++ "$binary": { ++ "base64": "EjRWeBI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "path": "encryptedText", ++ "bsonType": "string", ++ "queries": [ ++ { ++ "queryType": "substringPreview", ++ "strMaxLength": { ++ "$numberInt": "10" ++ }, ++ "strMinQueryLength": { ++ "$numberInt": "2" ++ }, ++ "strMaxQueryLength": { ++ "$numberInt": "6" ++ }, ++ "contention": { ++ "$numberLong": "0" ++ }, ++ "caseSensitive": true, ++ "diacriticSensitive": true ++ } ++ ] ++ } ++ ] ++} +diff --git a/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json b/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json +new file mode 100644 +index 000000000..51e72fd3c +--- /dev/null ++++ b/test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json +@@ -0,0 +1,339 @@ ++{ ++ "description": "QE-Text-prefixPreview", ++ "schemaVersion": "1.25", ++ "runOnRequirements": [ ++ { ++ "minServerVersion": "8.2.0", ++ "maxServerVersion": "8.99.99", ++ "topologies": [ ++ "replicaset", ++ "sharded", ++ "load-balanced" ++ ], ++ "csfle": { ++ "minLibmongocryptVersion": "1.19.1" ++ } ++ } ++ ], ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client", ++ "autoEncryptOpts": { ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "local": { ++ "key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk" ++ } ++ } ++ }, ++ "observeEvents": [ ++ "commandStartedEvent" ++ ] ++ } ++ }, ++ { ++ "database": { ++ "id": "db", ++ "client": "client", ++ "databaseName": "db" ++ } ++ }, ++ { ++ "collection": { ++ "id": "coll", ++ "database": "db", ++ "collectionName": "coll" ++ } ++ } ++ ], ++ "initialData": [ ++ { ++ "databaseName": "keyvault", ++ "collectionName": "datakeys", ++ "documents": [ ++ { ++ "_id": { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "keyMaterial": { ++ "$binary": { ++ "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", ++ "subType": "00" ++ } ++ }, ++ "creationDate": { ++ "$date": { ++ "$numberLong": "1648914851981" ++ } ++ }, ++ "updateDate": { ++ "$date": { ++ "$numberLong": "1648914851981" ++ } ++ }, ++ "status": { ++ "$numberInt": "0" ++ }, ++ "masterKey": { ++ "provider": "local" ++ } ++ } ++ ] ++ }, ++ { ++ "databaseName": "db", ++ "collectionName": "coll", ++ "documents": [], ++ "createOptions": { ++ "encryptedFields": { ++ "fields": [ ++ { ++ "keyId": { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "path": "encryptedText", ++ "bsonType": "string", ++ "queries": [ ++ { ++ "queryType": "prefixPreview", ++ "contention": { ++ "$numberLong": "0" ++ }, ++ "strMinQueryLength": { ++ "$numberLong": "3" ++ }, ++ "strMaxQueryLength": { ++ "$numberLong": "30" ++ }, ++ "caseSensitive": true, ++ "diacriticSensitive": true ++ } ++ ] ++ } ++ ] ++ } ++ } ++ } ++ ], ++ "tests": [ ++ { ++ "description": "Insert QE prefixPreview", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ } ++ ], ++ "expectEvents": [ ++ { ++ "client": "client", ++ "events": [ ++ { ++ "commandStartedEvent": { ++ "command": { ++ "listCollections": 1, ++ "filter": { ++ "name": "coll" ++ } ++ }, ++ "commandName": "listCollections" ++ } ++ }, ++ { ++ "commandStartedEvent": { ++ "command": { ++ "find": "datakeys", ++ "filter": { ++ "$or": [ ++ { ++ "_id": { ++ "$in": [ ++ { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ } ++ ] ++ } ++ }, ++ { ++ "keyAltNames": { ++ "$in": [] ++ } ++ } ++ ] ++ }, ++ "$db": "keyvault", ++ "readConcern": { ++ "level": "majority" ++ } ++ }, ++ "commandName": "find" ++ } ++ }, ++ { ++ "commandStartedEvent": { ++ "command": { ++ "insert": "coll", ++ "documents": [ ++ { ++ "_id": 1, ++ "encryptedText": { ++ "$$type": "binData" ++ } ++ } ++ ], ++ "ordered": true ++ }, ++ "commandName": "insert" ++ } ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "description": "Query with matching $encStrStartsWith", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ }, ++ { ++ "name": "find", ++ "arguments": { ++ "filter": { ++ "$expr": { ++ "$encStrStartsWith": { ++ "input": "$encryptedText", ++ "prefix": "foo" ++ } ++ } ++ } ++ }, ++ "object": "coll", ++ "expectResult": [ ++ { ++ "_id": { ++ "$numberInt": "1" ++ }, ++ "encryptedText": "foobar", ++ "__safeContent__": [ ++ { ++ "$binary": { ++ "base64": "wpaMBVDjL4bHf9EtSP52PJFzyNn1R19+iNI/hWtvzdk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "fmUMXTMV/XRiN0IL3VXxSEn6SQG9E6Po30kJKB8JJlQ=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "vZIDMiFDgjmLNYVrrbnq1zT4hg7sGpe/PMtighSsnRc=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "26Z5G+sHTzV3D7F8Y0m08389USZ2afinyFV3ez9UEBQ=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "q/JEq8of7bE0QE5Id0XuOsNQ4qVpANYymcPQDUL2Ywk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "Uvvv46LkfbgLoPqZ6xTBzpgoYRTM6FUgRdqZ9eaVojI=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "nMxdq2lladuBJA3lv3JC2MumIUtRJBNJVLp3PVE6nQk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "hS3V0qq5CF/SkTl3ZWWWgXcAJ8G5yGtkY2RwcHNc5Oc=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "McgwYUxfKj5+4D0vskZymy4KA82s71MR25iV/Enutww=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "Ciqdk1b+t+Vrr6oIlFFk0Zdym5BPmwN3glQ0/VcsVdM=", ++ "subType": "00" ++ } ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "description": "Query with non-matching $encStrStartsWith", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ }, ++ { ++ "name": "find", ++ "arguments": { ++ "filter": { ++ "$expr": { ++ "$encStrStartsWith": { ++ "input": "$encryptedText", ++ "prefix": "bar" ++ } ++ } ++ } ++ }, ++ "object": "coll", ++ "expectResult": [] ++ } ++ ] ++ } ++ ] ++} +diff --git a/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json b/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json +new file mode 100644 +index 000000000..1df317095 +--- /dev/null ++++ b/test/client-side-encryption/spec/unified/QE-Text-substringPreview.json +@@ -0,0 +1,468 @@ ++{ ++ "description": "QE-Text-substringPreview", ++ "schemaVersion": "1.25", ++ "runOnRequirements": [ ++ { ++ "minServerVersion": "8.2.0", ++ "maxServerVersion": "8.99.99", ++ "topologies": [ ++ "replicaset", ++ "sharded", ++ "load-balanced" ++ ], ++ "csfle": { ++ "minLibmongocryptVersion": "1.15.0" ++ } ++ } ++ ], ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client", ++ "autoEncryptOpts": { ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "local": { ++ "key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk" ++ } ++ } ++ }, ++ "observeEvents": [ ++ "commandStartedEvent" ++ ] ++ } ++ }, ++ { ++ "database": { ++ "id": "db", ++ "client": "client", ++ "databaseName": "db" ++ } ++ }, ++ { ++ "collection": { ++ "id": "coll", ++ "database": "db", ++ "collectionName": "coll" ++ } ++ } ++ ], ++ "initialData": [ ++ { ++ "databaseName": "keyvault", ++ "collectionName": "datakeys", ++ "documents": [ ++ { ++ "_id": { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "keyMaterial": { ++ "$binary": { ++ "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", ++ "subType": "00" ++ } ++ }, ++ "creationDate": { ++ "$date": { ++ "$numberLong": "1648914851981" ++ } ++ }, ++ "updateDate": { ++ "$date": { ++ "$numberLong": "1648914851981" ++ } ++ }, ++ "status": { ++ "$numberInt": "0" ++ }, ++ "masterKey": { ++ "provider": "local" ++ } ++ } ++ ] ++ }, ++ { ++ "databaseName": "db", ++ "collectionName": "coll", ++ "documents": [], ++ "createOptions": { ++ "encryptedFields": { ++ "fields": [ ++ { ++ "keyId": { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "path": "encryptedText", ++ "bsonType": "string", ++ "queries": [ ++ { ++ "queryType": "substringPreview", ++ "contention": { ++ "$numberLong": "0" ++ }, ++ "strMinQueryLength": { ++ "$numberLong": "3" ++ }, ++ "strMaxQueryLength": { ++ "$numberLong": "6" ++ }, ++ "strMaxLength": { ++ "$numberLong": "20" ++ }, ++ "caseSensitive": true, ++ "diacriticSensitive": true ++ } ++ ] ++ } ++ ] ++ } ++ } ++ } ++ ], ++ "tests": [ ++ { ++ "description": "Insert QE substringPreview", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ } ++ ], ++ "expectEvents": [ ++ { ++ "client": "client", ++ "events": [ ++ { ++ "commandStartedEvent": { ++ "command": { ++ "listCollections": 1, ++ "filter": { ++ "name": "coll" ++ } ++ }, ++ "commandName": "listCollections" ++ } ++ }, ++ { ++ "commandStartedEvent": { ++ "command": { ++ "find": "datakeys", ++ "filter": { ++ "$or": [ ++ { ++ "_id": { ++ "$in": [ ++ { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ } ++ ] ++ } ++ }, ++ { ++ "keyAltNames": { ++ "$in": [] ++ } ++ } ++ ] ++ }, ++ "$db": "keyvault", ++ "readConcern": { ++ "level": "majority" ++ } ++ }, ++ "commandName": "find" ++ } ++ }, ++ { ++ "commandStartedEvent": { ++ "command": { ++ "insert": "coll", ++ "documents": [ ++ { ++ "_id": 1, ++ "encryptedText": { ++ "$$type": "binData" ++ } ++ } ++ ], ++ "ordered": true ++ }, ++ "commandName": "insert" ++ } ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "description": "Query with matching $encStrContains", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ }, ++ { ++ "name": "find", ++ "arguments": { ++ "filter": { ++ "$expr": { ++ "$encStrContains": { ++ "input": "$encryptedText", ++ "substring": "oba" ++ } ++ } ++ } ++ }, ++ "object": "coll", ++ "expectResult": [ ++ { ++ "_id": { ++ "$numberInt": "1" ++ }, ++ "encryptedText": "foobar", ++ "__safeContent__": [ ++ { ++ "$binary": { ++ "base64": "wpaMBVDjL4bHf9EtSP52PJFzyNn1R19+iNI/hWtvzdk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "IpY3x/jjm8j/74jAdUhgxdM5hk68zR0zv/lTKm/72Vg=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "G+ky260C6QiOfIxKz14FmaMbAxvui1BKJO/TnLOHlGk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "7dv3gAKe9vwJMZmpB40pRCwRTmc7ds9UkGhxH8j084E=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "o0V+Efn6x8XQdE80F1tztNaT3qxHjcsd9DOQ47BtmQk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "sJvrCjyVot7PIZFsdRehWFANKAj6fmBaj3FLbz/dZLE=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "e98auxFmu02h5MfBIARk29MI7hSmvN3F9DaQ0xjqoEM=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "US83krGNov/ezL6IhsY5eEOCxv1xUPDIEL/nmY0IKi0=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "P2Aq5+OHZPG0CWIdmZvWq9c/18ZKVYW3vbxd+WU/TXU=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "8AdPRPnSzcd5uhq4TZfNvNeF0XjLNVwAsJJMTtktw84=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "9O6u/G51I4ZHFLhL4ZLuudbr0s202A2QnPfThmOXPhI=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "N7AjYVyVlv6+lVSTM+cIxRL3SMgs3G5LgxSs+jrgDkI=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "RbGF7dQbPGYQFd9DDO1hPz1UlLOJ77FAC6NsjGwJeos=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "m7srHMgKm6kZwsNx8rc45pmw0/9Qro6xuQ8lZS3+RYk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "K75CNU3JyKFqZWPiIsVi4+n7DhYmcPl/nEhQ3d88mVI=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "c7bwGpUZc/7JzEnMS7qQ/TPuXZyrmMihFaAV6zIqbZc=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "rDvEdUgEk8u4Srt3ETokWs2FXcnyJaRGQ+NbkFwi2rQ=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "VcdZj9zfveRBRlpCR2OYWau2+GokOFb73TE3gpElNiU=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "eOa9o2xfA6OgkbYUxd6wQJicaeN6guhy2V66W3ALsaA=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "1xGkJh+um70XiRd8lKLDtyHgDqrf7/59Mg7X0+KZh8k=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "OSvllqHxycbcZN4phR6NDujY3ttA59o7nQJ6V9eJpX0=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "ZTX1pyk8Vdw0BSbJx7GeJNcQf3tGKxbrrNSTqBqUWkg=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "cn7V05zb5iXwYrePGMHztC+GRq+Tj8IMpRDraauPhSE=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "E9bV9KyrZxHJSUmMg0HrDK4gGN+75ruelAnrM6hXQgY=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "WrssTNmdgXoTGpbaF0JLRCGH6cDQuz1XEFNTy98nrb0=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "jZmyOJP35dsxQ/OY5U4ISpVRIYr8iedNfcwZiKt29Qc=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "d2mocORMbX9MX+/itAW8r1kxVw2/uii4vzXtc+2CIRQ=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "JBnJy58eRPhDo3DuZvsHbvQDiHXxdtAx1Eif66k5SfA=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "OjbDulC8s62v0pgweBSsQqtJjJBwH5JinfJpj7nVr+A=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "85i7KT2GP9nSda3Gsil5LKubhq0LDtc22pxBxHpR+nE=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "u9Fvsclwrs9lwIcMPV/fMZD7L3d5anSfJQVjQb9mgLg=", ++ "subType": "00" ++ } ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "description": "Query with non-matching $encStrContains", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ }, ++ { ++ "name": "find", ++ "arguments": { ++ "filter": { ++ "$expr": { ++ "$encStrContains": { ++ "input": "$encryptedText", ++ "substring": "blah" ++ } ++ } ++ } ++ }, ++ "object": "coll", ++ "expectResult": [] ++ } ++ ] ++ } ++ ] ++} +diff --git a/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json b/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json +new file mode 100644 +index 000000000..e30d0cfd5 +--- /dev/null ++++ b/test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json +@@ -0,0 +1,339 @@ ++{ ++ "description": "QE-Text-suffixPreview", ++ "schemaVersion": "1.25", ++ "runOnRequirements": [ ++ { ++ "minServerVersion": "8.2.0", ++ "maxServerVersion": "8.99.99", ++ "topologies": [ ++ "replicaset", ++ "sharded", ++ "load-balanced" ++ ], ++ "csfle": { ++ "minLibmongocryptVersion": "1.19.1" ++ } ++ } ++ ], ++ "createEntities": [ ++ { ++ "client": { ++ "id": "client", ++ "autoEncryptOpts": { ++ "keyVaultNamespace": "keyvault.datakeys", ++ "kmsProviders": { ++ "local": { ++ "key": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk" ++ } ++ } ++ }, ++ "observeEvents": [ ++ "commandStartedEvent" ++ ] ++ } ++ }, ++ { ++ "database": { ++ "id": "db", ++ "client": "client", ++ "databaseName": "db" ++ } ++ }, ++ { ++ "collection": { ++ "id": "coll", ++ "database": "db", ++ "collectionName": "coll" ++ } ++ } ++ ], ++ "initialData": [ ++ { ++ "databaseName": "keyvault", ++ "collectionName": "datakeys", ++ "documents": [ ++ { ++ "_id": { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "keyMaterial": { ++ "$binary": { ++ "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", ++ "subType": "00" ++ } ++ }, ++ "creationDate": { ++ "$date": { ++ "$numberLong": "1648914851981" ++ } ++ }, ++ "updateDate": { ++ "$date": { ++ "$numberLong": "1648914851981" ++ } ++ }, ++ "status": { ++ "$numberInt": "0" ++ }, ++ "masterKey": { ++ "provider": "local" ++ } ++ } ++ ] ++ }, ++ { ++ "databaseName": "db", ++ "collectionName": "coll", ++ "documents": [], ++ "createOptions": { ++ "encryptedFields": { ++ "fields": [ ++ { ++ "keyId": { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ }, ++ "path": "encryptedText", ++ "bsonType": "string", ++ "queries": [ ++ { ++ "queryType": "suffixPreview", ++ "contention": { ++ "$numberLong": "0" ++ }, ++ "strMinQueryLength": { ++ "$numberLong": "3" ++ }, ++ "strMaxQueryLength": { ++ "$numberLong": "30" ++ }, ++ "caseSensitive": true, ++ "diacriticSensitive": true ++ } ++ ] ++ } ++ ] ++ } ++ } ++ } ++ ], ++ "tests": [ ++ { ++ "description": "Insert QE suffixPreview", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ } ++ ], ++ "expectEvents": [ ++ { ++ "client": "client", ++ "events": [ ++ { ++ "commandStartedEvent": { ++ "command": { ++ "listCollections": 1, ++ "filter": { ++ "name": "coll" ++ } ++ }, ++ "commandName": "listCollections" ++ } ++ }, ++ { ++ "commandStartedEvent": { ++ "command": { ++ "find": "datakeys", ++ "filter": { ++ "$or": [ ++ { ++ "_id": { ++ "$in": [ ++ { ++ "$binary": { ++ "base64": "q83vqxI0mHYSNBI0VniQEg==", ++ "subType": "04" ++ } ++ } ++ ] ++ } ++ }, ++ { ++ "keyAltNames": { ++ "$in": [] ++ } ++ } ++ ] ++ }, ++ "$db": "keyvault", ++ "readConcern": { ++ "level": "majority" ++ } ++ }, ++ "commandName": "find" ++ } ++ }, ++ { ++ "commandStartedEvent": { ++ "command": { ++ "insert": "coll", ++ "documents": [ ++ { ++ "_id": 1, ++ "encryptedText": { ++ "$$type": "binData" ++ } ++ } ++ ], ++ "ordered": true ++ }, ++ "commandName": "insert" ++ } ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "description": "Query with matching $encStrEndsWith", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ }, ++ { ++ "name": "find", ++ "arguments": { ++ "filter": { ++ "$expr": { ++ "$encStrEndsWith": { ++ "input": "$encryptedText", ++ "suffix": "bar" ++ } ++ } ++ } ++ }, ++ "object": "coll", ++ "expectResult": [ ++ { ++ "_id": { ++ "$numberInt": "1" ++ }, ++ "encryptedText": "foobar", ++ "__safeContent__": [ ++ { ++ "$binary": { ++ "base64": "wpaMBVDjL4bHf9EtSP52PJFzyNn1R19+iNI/hWtvzdk=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "uDCWsucUsJemUP7pmeb+Kd8B9qupVzI8wnLFqX1rkiU=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "W3E1x4bHZ8SEHFz4zwXM0G5Z5WSwBhnxE8x5/qdP6JM=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "6g/TXVDDf6z+ntResIvTKWdmIy4ajQ1rhwdNZIiEG7A=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "hU+u/T3D6dHDpT3d/v5AlgtRoAufCXCAyO2jQlgsnCw=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "vrPnq0AtBIURNgNGA6HJL+5/p5SBWe+qz8505TRo/dE=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "W5pylBxdv2soY2NcBfPiHDVLTS6tx+0ULkI8gysBeFY=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "oWO3xX3x0bYUJGK2S1aPAmlU3Xtfsgb9lTZ6flGAlsg=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "SjZGucTEUbdpd86O8yj1pyMyBOOKxvAQ9C8ngZ9C5UE=", ++ "subType": "00" ++ } ++ }, ++ { ++ "$binary": { ++ "base64": "CEaMZkxVDVbnXr+To0DOyvsva04UQkIYP3KtgYVVwf8=", ++ "subType": "00" ++ } ++ } ++ ] ++ } ++ ] ++ } ++ ] ++ }, ++ { ++ "description": "Query with non-matching $encStrEndsWith", ++ "operations": [ ++ { ++ "name": "insertOne", ++ "arguments": { ++ "document": { ++ "_id": 1, ++ "encryptedText": "foobar" ++ } ++ }, ++ "object": "coll" ++ }, ++ { ++ "name": "find", ++ "arguments": { ++ "filter": { ++ "$expr": { ++ "$encStrEndsWith": { ++ "input": "$encryptedText", ++ "suffix": "foo" ++ } ++ } ++ } ++ }, ++ "object": "coll", ++ "expectResult": [] ++ } ++ ] ++ } ++ ] ++}