[SERVER-11626] db.auth() shouldn't mutate its argument Created: 07/Nov/13  Updated: 11/Jul/16  Resolved: 07/Jan/14

Status: Closed
Project: Core Server
Component/s: Security, Shell
Affects Version/s: 2.4.8, 2.5.3
Fix Version/s: 2.5.5

Type: Bug Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

Calling db.auth() with a document as the arg mutates the document by adding a "mechanism" and a "userSource" or "db" field to the doc. This prevents the same doc from being used for a future auth call.

> var authDoc = {user:'spencer', pwd:'pwd'}
> db.auth(authDoc)
1
> authDoc
{
        "user": "spencer",
        "pwd": "pwd",
        "mechanism": "MONGODB-CR",
        "db": "test"
}



 Comments   
Comment by Githook User [ 07/Jan/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-11626 Have db.auth shell helper copy its argument, rather than mutate it.
Branch: master
https://github.com/mongodb/mongo/commit/97176b9b73f8a5f2903865f80fcdc87586fa30af

Generated at Thu Feb 08 03:26:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.