[SERVER-27554] Authorization error when using the find() method on the system.views collection Created: 30/Dec/16 Updated: 27/Oct/23 Resolved: 03/Jan/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Security |
| Affects Version/s: | 3.4.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Jason Swartzbaugh | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | read-only-views | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: |
|
||||||||
| Participants: | |||||||||
| Case: | (copied to CRM) | ||||||||
| Description |
|
When access control is not enabled, I am able to execute a db.system.views.find() command and get back the metadata about any view(s) that has been created for that database.
When access control has been enabled using SCRAM-SHA1 username/password and a role of root, I get an auth error when issuing the same db.system.views.find() command.
My understanding is that the root role provides full privileges on all resources, so I would assume that I should be able to execute a find() against the system.views collection in the same way I did when security was not enabled. |
| Comments |
| Comment by David Storch [ 03/Jan/17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
kyle.suarez, no objections! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kyle Suarez [ 03/Jan/17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello jason.swartzbaugh and shawn.mccarthy, Per the built-in roles documentation, the dbAdmin role "provides [a bunch of actions] on all non-system collections. This role does not include full read access on non-system collections." There are three exceptions for which the find action is granted: system.indexes, system.namespaces and system.profile. The root role is similar: like dbAdmin, it is just a bundle of other roles, including readWriteAnyDatabase and dbAdminAnyDatabase, so it also does not get full read access to system collections. As schwerin points out, the existence of the system.views collection is an implementation detail. A user with the dbAdmin or root roles should prefer to do all of their views-related maintenance using commands like listCollections, create and collMod, as the content of the data in this collection is subject to change. As such, I'm inclined to close this as Works as Designed, unless david.storch has any objections. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jason Swartzbaugh [ 31/Dec/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks schwerin and shawn.mccarthy, I created a custom role via Cloud Manager that allows me to use the find() method to see the view metadata. I guess I'm wondering if a privilege like this should be automatically included with the "root" and "dbOwner" roles (and possibly others) as well? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Shawn McCarthy (Inactive) [ 30/Dec/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I was helping jason.swartzbaugh with the ticket, here is what I was able to do:
As the user with the dbOwner permission I was able to do everything - listCollections, create & read indexes, create roles and assign these roles to myself, but I was not able to execute a find on the system.views collection. I was assuming that I would be able to run a find on that collection to get the information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andy Schwerin [ 30/Dec/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The root role does not have every privilege, by design. However, I am not certain if it is intended to have this privilege. As a workaround, you can use listCollections to enumerate the views, or grant "find" on "db.system.views" to a custom role and assign it to your user. It's probably more future-proof to use listCollections. The schema and even existence of the system.views collection is an implementation detail. |