I have recently upgraded to mongo 4.2.0 from 4.0.2. On previous version user was able to access system.indexes but after upgrade, user is not able to access system.indexes collection. User already has readWrite role. Also, I tried giving dbAdmin but still no luck.
After enabling debug logs for mongo, it is showing me not authorized for query on testdb.system.indexes src/mongo/db/commands/find_cmd.cpp 170.
Anybody faced this issue?
Below is the output of
{
"role" : "read",
"db" : "testdb",
"isBuiltin" : true,
"roles" : [ ],
"inheritedRoles" : [ ],
"privileges" : [
{
"resource" : {
"db" : "testdb",
"collection" : ""
},
"actions" : [
"changeStream",
"collStats",
"dbHash",
"dbStats",
"find",
"killCursors",
"listCollections",
"listIndexes",
"planCacheRead"
]
},
{
"resource" : {
"db" : "testdb",
"collection" : "system.js"
},
"actions" : [
"changeStream",
"collStats",
"dbHash",
"dbStats",
"find",
"killCursors",
"listCollections",
"listIndexes",
"planCacheRead"
]
}
],
"inheritedPrivileges" : [
{
"resource" : {
"db" : "testdb",
"collection" : ""
},
"actions" : [
"changeStream",
"collStats",
"dbHash",
"dbStats",
"find",
"killCursors",
"listCollections",
"listIndexes",
"planCacheRead"
]
},
{
"resource" : {
"db" : "testdb",
"collection" : "system.js"
},
"actions" : [
"changeStream",
"collStats",
"dbHash",
"dbStats",
"find",
"killCursors",
"listCollections",
"listIndexes",
"planCacheRead"
]
}
]
}
I am able to fix this issue by creating a new role for system.indexes collection and attach this role to user.
Strange thing is, this issue happens when you upgrade mongo by replacing binaries.
I tried to have a fresh instance with 4.2 mongo installed and then replicating data to it, it worked fine. But I cannot do this on production due to some technical reasons.
Dear Mongo team,
I tried to upgrade mongo using https://docs.mongodb.com/manual/tutorial/upgrade-revision/#upgrade-replace-binaries, but got above issue. I think doc is missing few details related to
system.indexesaccess related change