-
Notifications
You must be signed in to change notification settings - Fork 88
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
MONGOCRYPT-463 check the collMod
command for validator.$jsonSchema
#441
Conversation
collMod
command for validator.$jsonSchema
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.
LGTM, but one odd comment
src/mongocrypt-ctx-encrypt.c
Outdated
@@ -1946,19 +1947,23 @@ _try_empty_schema_for_create (mongocrypt_ctx_t *ctx) | |||
* } | |||
* } | |||
* If the "create" command does not include a JSON schema, an empty JSON schema | |||
* is returned. This is to avoid an unnecessary 'listCollections' command for | |||
* create. */ | |||
* is later. This is to avoid an unnecessary 'listCollections' command for |
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.
"is later"?
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.
Fixed.
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.
Minor suggestion; otherwise, LGTM.
src/mongocrypt-ctx-encrypt.c
Outdated
* create. | ||
* | ||
* If the "collMod" command does not include a JSON schema, a schema is later | ||
* requested from other sources. This is because a "collMod" command may have |
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.
Can "from other sources" be made more specific, e.g. mention the MONGOCRYPT_CTX_NEED_MONGO_COLLINFO
state?
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.
Done.
…create_or_collMod_cmd
Summary
collMod
command forvalidator.$jsonSchema
and send it to query analysis.Background & Motivation
Checking collMod for
validator.$jsonSchema
Since MONGOCRYPT-429, automatic encryption has supported the
collMod
command. Prior to MONGOCRYPT-429, it was always an error to automatically encrypt acollMod
command. AcollMod
command is not bypassed because it may include sensitive plaintext in avalidator
field:A
collMod
command may also include avalidator.$jsonSchema
:If a
collMod
includes avalidator.$jsonSchema
, Query Analysis (mongocryptd or the mongo_crypt shared library) expects thejsonSchema
field added by libmongocrypt to match. See MONGOCRYPT-463 for an example of this error.A regression specification test is tested with the Go driver here