-
Notifications
You must be signed in to change notification settings - Fork 245
DRIVERS-3213 add text search explicit encryption API and tests #1824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There is no query type "textPreview". Use more generic term.
"subType": "04" | ||
} | ||
}, | ||
"path": "encrypted-textPreview", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests seem to be using the field encryptedText
not encrypted-textPreview
- should this be encryptedText
?
textOpts: TextOpts { | ||
caseSensitive: true, | ||
diacriticSensitive: true, | ||
prefix: <PrefixOpts>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: moving PrefixOpts and SuffixOpts to this section
|
||
#### Case 2: can find a document by suffix | ||
|
||
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`. | |
Use `clientEncryption.encrypt()` to encrypt the string `"baz"`. Store the resulting payload in `findPayload`. |
Use `encryptedClient` to run a "find" operation on the `db.prefix-suffix` collection with the following filter: | ||
|
||
```javascript | ||
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } } | |
{ $expr: { $encStrEndsWith: { input: '$encryptedText', suffix: <findPayload> } } } |
|
||
#### Case 3: assert no document found by prefix | ||
|
||
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this test find foobarbaz
? Should we be encrypting a different value here?
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`. | ||
|
||
Use `encryptedClient` to run a "find" operation on the `db.substring` collection with the following filter: | ||
|
||
```javascript | ||
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed to test substring
|
||
```javascript | ||
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } } | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with this predicate
"subType": "04" | ||
} | ||
}, | ||
"path": "encrypted-textPreview", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"path": "encrypted-textPreview", | |
"path": "encryptedText", |
Summary
Background & Motivation
libmongocrypt
Driver bindings to libmongocrypt will need to pass explicit options through the new helper added in 1.15.0:
mongocrypt_ctx_setopt_algorithm_text
.TextOpts
The structure of TextOpts resembles the placeholder created by query analysis (mongocryptd/crypt_shared): FLE2TextSearchInsertSpec. The repeated parameters (e.g.
suffix.strMaxQueryLength
andprefix.strMaxQueryLength
) are to support a field with both prefix and suffix queries with different values.Please complete the following before merging:
clusters).
C driver implementation: https://spruce.mongodb.com/version/6894132fba56770007851f12