Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1052

Improve error message when using SCRAM authentication over an X.509 connection

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • No version
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 1
    • Not Needed

      Problem Statement/Rationale

      When using mongosh with X.509 credentials, if a user attempts to manually re-authenticate with SCRAM, they get this error:

      MongoParseError: [object Object] can only have authSource set to '$external'

      This case should error per the auth spec, but the message returned is cryptic, especially due to the "[object Object]" portion.

      Steps to Reproduce

      Start a mongod server with an X.509 user registered and authentication enabled. After that, these commands should repro the issue:

      > mongosh --tlsAllowInvalidHostnames --tls --tlsCAFile <file> --tlsCertificateKeyFile <file>  --authenticationMechanism MONGODB-X509
      > use admin
      > db.auth("user", "pwd")
      

      Expected Results

      An error occurs and the message clearly explains the issue.

      Actual Results

      An error occurs but the message is a bit cryptic.

      Additional Notes

      This message is coming from the Node.js driver here, but I'm not sure if the [object Object] display is due to the driver or the shell.

      Also, I wanted to file this as an Improvement but didn't see that category, so I filed as bug instead. Feel free to change if there's a better category.

            Assignee:
            Unassigned Unassigned
            Reporter:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: