[CDRIVER-4398] Commands to mongocryptd 6.0.0-rc5+ error with database mismatch Created: 30/May/22  Updated: 28/Oct/23  Resolved: 03/Jun/22

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.22.0, 1.22.0-beta0

Type: Bug Priority: Unknown
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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"
}



 Comments   
Comment by Githook User [ 03/Jun/22 ]

Author:

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

Message: CDRIVER-4398 use matching db for mongocryptd command (#1020)
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/36df177e4921b55ecd2faab2fe5fa5105715c11f

Generated at Wed Feb 07 21:20:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.