Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3333

[2.0] (options.ClientOptions).SetAuth with MONGODB-AWS does not set default $external AuthSource

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Go Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Detailed steps to reproduce the problem?

      opts.ApplyURI(...).SetAuth(options.Credential{AuthMechanism: "MONGODB-AWS"})
      

      When I try to connect with these client options, I get the following error:

      MONGODB-AWS source must be empty or $external 

      However, AuthSource is empty here...I would expect it to be set to $external, which is what happens when the auth mechanism is specified in the URI instead of through the client options (source).

      https://github.com/mongodb/specifications/blob/master/source/auth/auth.md#mongocredential-properties-5

      Definition of done: what must be done to consider the task complete?

      Using SetAuth with an AuthMechanism of MONGODB-AWS should not result in an error if AuthSource is unspecified.

      I'm no Go Driver expert, but I think this is happening because of this line: https://github.com/mongodb/mongo-go-driver/blob/1649d33597960a4863fc4e8009e146576edcc61d/x/mongo/driver/topology/topology_options.go#L178

      Could this be an issue in other drivers?

      The exact Go version used, with patch level:

      $ go version

      1.22.2

      The exact version of the Go driver used:

      $ go list -m go.mongodb.org/mongo-driver

      1.12.0

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      Atlas clusters (both sharded and replica sets)

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      AL2

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            thomas.zembowicz@mongodb.com Thomas Zembowicz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: