[SERVER-67431] Change command listDatabases to only list dbs of current tenant Created: 21/Jun/22  Updated: 29/Oct/23  Resolved: 04/Oct/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Sophia Tan Assignee: Adi Agrawal
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-10-03, Server Serverless 2022-10-17
Participants:

 Description   

Today, the listDatabases command does not filter dbs with current tenant of the command request. In this ticket, we should change this so that we only list dbs of the current tenant, if one sent in the request. In order to do this, we'll want to filter out the list returned here to only include dbs who have a matching tenantId. Then, pass this filtered list to setReplyItems.

We need to follow the same behavior for serializing the DatabaseNames as we are for NamespaceStrings, so we may want to create a similar serialize function for DatabaseName as we did for NamespaceString, and then use it to return the serialized database names correctly here instead of always calling db() as we are today.

Then, let's add a test to the native_tenant_data_isolation_basic... tests to test that this works both when sending this command with $tenant, and when sending it with a security token.



 Comments   
Comment by Githook User [ 04/Oct/22 ]

Author:

{'name': 'Adityavardhan Agrawal', 'email': 'aa729@cornell.edu', 'username': 'Adityav369'}

Message: SERVER-67431: Filter listDatabases by tenantId
Branch: master
https://github.com/mongodb/mongo/commit/002ed3c0fdfbc3b958626ad7b04ea375a4851e6b

Generated at Thu Feb 08 06:08:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.