-
Notifications
You must be signed in to change notification settings - Fork 456
CDRIVER-6044 Text search explicit encryption API and prose tests #2084
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
|
||
void | ||
mongoc_encrypt_text_opts_destroy(mongoc_encrypt_text_opts_t *topts) | ||
{ |
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.
For consistency with other _destroy
functions, return if argument is NULL:
if (!topts) {
return;
}
I expect this may fix ASan tasks:
mongoc-client-side-encryption.c:636:51: runtime error: member access within null pointer of type 'mongoc_encrypt_text_opts_t' (aka 'struct _mongoc_encrypt_text_opts_t')
@@ -182,6 +190,67 @@ mongoc_client_encryption_get_key(mongoc_client_encryption_t *client_encryption, | |||
bson_t *key_doc, | |||
bson_error_t *error); | |||
|
|||
MONGOC_EXPORT(mongoc_encrypt_text_prefix_opts_t *) | |||
mongoc_encrypt_text_prefix_opts_new(void); |
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.
Add .rst docs for the new API.
BSON_ASSERT_PARAM(bson_text_opts); | ||
BSON_ASSERT_PARAM(opts); | ||
|
||
BSON_ASSERT(BSON_APPEND_BOOL(bson_text_opts, "caseSensitive", opts->case_sensitive)); |
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.
I expect caseSensitive
and diacriticSensitive
should only be applied if set, like:
if (opts->diacritic_sensitive.set) {
BSON_ASSERT(BSON_APPEND_BOOL(bson_text_opts, "diacriticSensitive", opts->diacritic_sensitive.value));
}
The current implementation defaults to false
. The spec requires these be set. If a user does not set either field, I expect libmongocrypt will error.
"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.
Suggest updating the encryptedFields files to match what is in the spec. The spec refers to "encryptedText".
@@ -1668,6 +1671,18 @@ _create_explicit_state_machine(_mongoc_crypt_t *crypt, | |||
mongocrypt_binary_destroy(binary_range_opts); | |||
} | |||
|
|||
if (text_opts != NULL) { | |||
/* mongocrypt error checks and parses range options */ |
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.
/* mongocrypt error checks and parses range options */ | |
/* mongocrypt error checks and parses text options */ |
No description provided.