[DRIVERS-2441] Error if RewrapManyDataKey is called with masterKey and without provider Created: 14/Sep/22  Updated: 23/Jun/23  Resolved: 23/Jun/23

Status: Closed
Project: Drivers
Component/s: Client Side Encryption
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split to CDRIVER-4498 Error if RewrapManyDataKey is called ... Closed
split to CSHARP-4357 Error if RewrapManyDataKey is called ... Closed
split to CXX-2599 Error if RewrapManyDataKey is called ... Closed
split to GODRIVER-2584 Error if RewrapManyDataKey is called ... Closed
split to MOTOR-1048 Error if RewrapManyDataKey is called ... Closed
split to NODE-4708 Error if RewrapManyDataKey is called ... Closed
split to PHPC-2148 Error if RewrapManyDataKey is called ... Closed
split to PYTHON-3469 Error if RewrapManyDataKey is called ... Closed
split to RUBY-3156 Error if RewrapManyDataKey is called ... Closed
split to RUST-1506 Error if RewrapManyDataKey is called ... Closed
split to JAVA-4766 Test that exception is thrown if Rewr... Closed
Related
is related to JAVA-4717 rewrapManyDataKey doesn't throw an er... Closed
Driver Changes: Needed
Quarter: FY24Q2
Downstream Changes Summary:

If applicable, implement the "Case 2: RewrapManyDataKeyOpts.provider is not optional" specified in https://github.com/mongodb/specifications/commit/4703757119d96fa1438158ece0a30c2186f47800

If the test does not pass, this may suggest the driver needs to be changed to return an expected error when `RewrapManyDataKeyOpts.provider` is not set and `RewrapManyDataKeyOpts.masterKey` is set.

Engineering Lead: Kevin Albertson Kevin Albertson
Product Manager: Rishabh Bisht Rishabh Bisht
Program Manager: Esha Bhargava Esha Bhargava
Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-4498 Fixed 1.23.5
CXX-2599 Fixed 3.8.0
CSHARP-4357 Done 2.20.0
GODRIVER-2584 Fixed 1.11.7
JAVA-4766 Done
NODE-4708 Fixed 5.6.0
MOTOR-1048 Duplicate
PYTHON-3469 Fixed 4.4
PHPC-2148 Fixed 1.15.0
RUBY-3156 Fixed 2.19.0
RUST-1506 Works as Designed
SWIFT-1654 Won't Do

 Description   

Summary

  • Error if RewrapManyDataKey is called with masterKey and without provider.
  • Add a prose or specification test for the error check.

Motivation

RewrapManyDataKeyOpts is specified as an optional argument to RewrapManyDataKey:

rewrapManyDataKey(filter: Document, opts: RewrapManyDataKeyOpts | null): RewrapManyDataKeyResult;

If RewrapManyDataKeyOpts is set, provider is required, and masterKey is optional:

class RewrapManyDataKeyOpts {
   provider: String
   masterKey: Optional<Document>
}

Some driver implementations do not represent RewrapManyDataKeyOpts as a separate type. Instead, the provider and masterKey are both optional arguments to RewrapManyDataKey.

For example, in C:

MONGOC_EXPORT (bool)
mongoc_client_encryption_rewrap_many_datakey (
   mongoc_client_encryption_t *client_encryption,
   const bson_t *filter,
   const char *provider,
   const bson_t *master_key,
   mongoc_client_encryption_rewrap_many_datakey_result_t *result,
   bson_error_t *error);

If mongoc_client_encryption_rewrap_many_datakey is called with a master_key but a NULL provider, no error is returned. The expected behavior is to require provider when master_key is set.

Who is the affected end user?

This impacted Java in JAVA-4717. It may impact any user of RewrapManyDataKey and cause confusion.

How does this affect the end user?

Confusion.

How likely is it that this problem or use case will occur?

Likely. This has impacted users already.

If the problem does occur, what are the consequences and how severe are they?

Confusion.

Is this issue urgent?

No.

Is this ticket required by a downstream team?

No.

Is this ticket only for tests?

No.



 Comments   
Comment by Githook User [ 10/May/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: DRIVERS-2441 add prose test Rewrap Case 2 (#1413)

Test "Rewrap returns error if masterKey is set, but provider is not set"

  • Apply suggested rewordings

Co-authored-by: Ezra Chung <88335979+eramongodb@users.noreply.github.com>

  • Remove unnecessary content of `masterKey`

Co-authored-by: Ezra Chung <88335979+eramongodb@users.noreply.github.com>

---------

Co-authored-by: Ezra Chung <88335979+eramongodb@users.noreply.github.com>
Branch: master
https://github.com/mongodb/specifications/commit/4703757119d96fa1438158ece0a30c2186f47800

Generated at Thu Feb 08 08:25:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.