MONGOCRYPT-771 Remove check for $jsonSchema
siblings
#948
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Do not error if remote
$jsonSchema
has sibling fields.Background & Motivation
When processing a response to
listCollections
, libmongocrypt only checks the response for a top-level$jsonSchema
withinvalidator
.libmongocrypt errors if the
$jsonSchema
has sibling fields and query analysis (mongocryptd/crypt_shared) indicates the JSON Schema has encrypted fields:The spec says this of the motivation:
However, this check seems incomplete. A validator can have a single top-level JSON schema keyword, and reference encrypted fields:
And this check can error in valid cases:
I do not expect this check is useful. If a
$jsonSchema
has sibling fields that contradict the$jsonSchema
, I expect that is a misconfiguration that would be discovered soon after attempting to insert data. If the siblings do not contradict the JSON Schema, then there is no reason to error.Related to: #947, query analysis 8.1 supports a new field
csfleEncryptionSchemas
to accept multiple JSON Schemas. The repliedschemaRequiresEncryption
only indicates if any of the sent schemas require encryption. Multiple schemas further complicates this check (I.e. if libmongocrypt gets"schemaRequiresEncryption": true
it does not know which of the JSON Schemas required encryption).