Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2441

Error if RewrapManyDataKey is called with masterKey and without provider

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: Client Side Encryption
    • None
    • Needed
    • Hide

      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.

      Show
      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.
    • $i18n.getText("admin.common.words.hide")
      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
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } 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

      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.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Kevin Albertson Kevin Albertson
            Rishabh Bisht Rishabh Bisht
            Esha Bhargava Esha Bhargava
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: