[SERVER-46597] balancerCollectionStatus command fails with Unauthorized when using db.adminCommand Created: 03/Mar/20  Updated: 29/Oct/23  Resolved: 05/Mar/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 4.3.3
Fix Version/s: 4.4.0-rc0, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Marcos José Grillo Ramirez Assignee: Marcos José Grillo Ramirez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Steps To Reproduce:
  • Set up a sharded cluster
  • Enable auth
  • Try the balancerCollectionStatus using db.adminCommand as an administrator

 

Participants:

 Description   

When using db.adminCommand the balancerCollectionStatus command fails:

 

mongos> db.adminCommand({balancerCollectionStatus:'test.foo'})
{
        "ok" : 0,
        "errmsg" : "not authorized on admin to execute command { balancerCollectionStatus: \"test.foo\", lsid: { id: UUID(\"eb2eddd6-a9fc-4a8a-8c55-3d05daac22cb\") }, $clusterTime: { clusterTime: Timestamp(1583272313, 6) }, $db: \"admin\" }",
        "code" : 13,
        "codeName" : "Unauthorized",
        "operationTime" : Timestamp(1583272354, 1),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1583272354, 1)
        }
}

The API should work similarly to shardCollection and with the same roles as shardCollection would.



 Comments   
Comment by Githook User [ 06/Mar/20 ]

Author:

{'username': 'm4nti5', 'name': 'Marcos José Grillo Ramírez', 'email': 'marcos.grillo@mongodb.com'}

Message: SERVER-46597 balancerCollectionStatus command fails with Unauthorized when using db.adminCommand

(cherry picked from commit ab2ec5c8d4f4b203c4ad9a39a20480a1fc9ff1d4)
Branch: v4.4
https://github.com/mongodb/mongo/commit/4f5f6af381ebed68b03f8690b3a71a6c0f466eb2

Comment by Githook User [ 05/Mar/20 ]

Author:

{'username': 'm4nti5', 'name': 'Marcos José Grillo Ramírez', 'email': 'marcos.grillo@mongodb.com'}

Message: SERVER-46597 balancerCollectionStatus command fails with Unauthorized when using db.adminCommand
Branch: master
https://github.com/mongodb/mongo/commit/ab2ec5c8d4f4b203c4ad9a39a20480a1fc9ff1d4

Generated at Thu Feb 08 05:11:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.