[COMPASS-7122] Investigate changes in SERVER-77551: Ensure only users with allowed permissions may invoke query settings commands Created: 17/Aug/23  Updated: 29/Jan/24  Resolved: 29/Jan/24

Status: Closed
Project: Compass
Component/s: None
Affects Version/s: None
Fix Version/s: No version

Type: Investigation Priority: Minor - P4
Reporter: Backlog - Core Eng Program Management Team Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-77551 Ensure only users with allowed permis... Closed
Epic Link: COMPASS-6403
Documentation Changes: Not Needed

 Description   
Original Downstream Change Summary

We have introduced a new action and built-in role called "querySettings".

Description of Linked Ticket

We need to ensure that only users with the allowed permissions are able to invoke the query settings commands and agg stage.

One way of doing it is through modification of the idl definition.

 

What we need to is:

  • introduce a new action_type query_settings in action_type.idl file
  • modify the query settings commands idl file to include the permission check as described in the code snippet

# in query_settings_cmds.idl
 
- "mongo/db/auth/access_checks.idl"
- "mongo/db/auth/action_type.idl"
...
    access_check:
      simple:
        privilege:
          resource_pattern: cluster
          action_type: query_settings 

 

  • perform the authorisation check as described in the following code snippet

 

auto authzSession = AuthorizationSession::get(Client::getCurrent()); 
authzSession->verifyContract(&SetQuerySettingsCommandRequest::kAuthorizationContract); 

 

  • for agg stage the privilege has to be defined in aggregate_command.idl as follows

 

...
- privilege: # $querySettings
  resource_pattern: cluster
  action_type: query_settings

 

  • adjust the privilege vector definition for the $querySettings agg stage
  • extend the existing permission tests to ensure that authorization is performed accordingly in commands_lib.js


 Comments   
Comment by Anna Henningsen [ 29/Jan/24 ]

No impact

Comment by PM Bot [ 17/Aug/23 ]

Fix Version updated for upstream SERVER-77551:
7.1.0-rc0

Generated at Wed Feb 07 22:45:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.