-
Notifications
You must be signed in to change notification settings - Fork 455
CDRIVER-4498 return error if masterKey
is set, but provider
is not set
#1259
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
Conversation
masterKey
is set, but provider
is not set
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 suggestions; otherwise, LGTM.
clientEncryption, | ||
NULL /* filter */, | ||
NULL /* kms_provider */, | ||
tmp_bson ("{'foo': 'bar'}"), |
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.
tmp_bson ("{'foo': 'bar'}"), | |
tmp_bson ("{}"), |
&error); | ||
// Assert an error is returned from the driver suggesting that the | ||
// ``provider`` option is required. | ||
ASSERT (!ok && "expected error, but got success"); |
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.
ASSERT (!ok && "expected error, but got success"); | |
ASSERT_WITH_MSG (!ok, "expected error, but got success"); |
Co-authored-by: Ezra Chung <[email protected]>
…t set (#1259) * add CSE Prose Test 16: Case 2 * return error if `provider` is not set when `master_key` is set * Simplify assertion of provider Co-authored-by: Ezra Chung <[email protected]> * update commented test name to match specification * use empty doc for masterKey to match specification * use ASSERT_WITH_MSG * clarify in docs that current master key is used when provider is NULL --------- Co-authored-by: Ezra Chung <[email protected]>
Summary
masterKey
is set, butprovider
is not set forrewrapManyDataKey
Background & Motivation
The specified API for
rewrapManyDataKey
does not permit calling with a setmasterKey
without aprovider
.Some driver implementations do not represent
RewrapManyDataKeyOpts
as a separate type. Instead, theprovider
andmasterKey
are both optional arguments toRewrapManyDataKey
.The C driver API permits setting
masterKey
withoutprovider
:The current behavior of
mongoc_client_encryption_rewrap_many_datakey
silently ignores themaster_key
option ifprovider
is NULL.This may result in unexpected behavior. A user may be attempting to rewrap keys with a new
master_key
and mistakenly passed a NULLprovider
. A NULLprovider
results in rewrapping with the samemaster_key
.The Java driver had similar behavior, which was fixed in JAVA-4717.