Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4398

Commands to mongocryptd 6.0.0-rc5+ error with database mismatch

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.22.0, 1.22.0-beta0
    • Affects Version/s: None
    • Component/s: None
    • None

      Summary

      The "$db" sent to mongocryptd is always "admin": https://github.com/mongodb/mongo-c-driver/blob/b759748551320ffa1105dcb5724970bfdac94fd6/src/libmongoc/src/mongoc/mongoc-crypt.c#L311.

      This is an error on mongocryptd 6.0.0-rc6 and newer when the command includes "encryptionInformation"

      Background

      mongocryptd 6.0.0-rc5 responds with an error if the database name in "encryptionInformation" does not match "$db". Example:

      {
          "find": "default",
          "filter": {},
          "encryptionInformation": {
              "type": 1,
              "schema": {
                  "default.default": {
                      "escCollection": "enxcol_.default.esc",
                      "eccCollection": "enxcol_.default.ecc",
                      "ecocCollection": "enxcol_.default.ecoc",
                      "fields": []
                  }
              }
          },
          "$db": "admin"
      }
      

      mongocryptd 6.0.0-rc5 and newer will respond with:

      {
          "ok": 0.0,
          "errmsg": "Namespace in encryptionInformation: 'default.default' does not match namespace given in command: 'admin.default'",
          "code": 6411900,
          "codeName": "Location6411900"
      }
      

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: