[SERVER-72083] Tenant id is dropped off during parsing struct items in IDL command request with OpMsgRequest Created: 13/Dec/22  Updated: 29/Oct/23  Resolved: 16/Jan/23

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

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

Assigned Teams:
Serverless
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Server Serverless 2023-01-09, Server Serverless 2023-01-23
Participants:
Story Points: 2

 Description   

When command request is parsed from OpMsgRquest object, the tenant id is passed in with OpMsgRquest object's validate tenancy scope.
Currently, the tenant id can be used correctly to create NamespaceString object or array which is directly defined in the command fields. But, unfortunately, if the field type is defined as a struct and holds tenant id in the struct, the tenant id is dropped off.

For example, for nsInfo list in bulkWrite command, the nss is defined in struct NamespaceInfoEntry. Here is the IDL generated code for parsing the request

void BulkWriteCommandRequest::parseProtected(const IDLParserContext& ctxt, const OpMsgRequest& request) {
....        
    IDLParserContext tempContext(kNsInfoFieldName, &ctxt);
    const auto localObject = arrayElement.Obj();
     values.emplace_back(mongo::NamespaceInfoEntry::parse(tempContext, localObject));
                      
 }

In the code, tenant id is dropped off when NamespaceInfoEntry is parsed with `NamespaceInfoEntry::parse(tempContext, localObject)` as we didn't pass in OpMsgRequest's validated tenant id to the root IDLParseContext of tempContext. 

 



 Comments   
Comment by Githook User [ 15/Jan/23 ]

Author:

{'name': 'Sophia Tan', 'email': 'sophia_tll@hotmail.com', 'username': 'sophiatll'}

Message: SERVER-72083 Pass in tenant information when parsing ns in struct items of IDL command
Branch: master
https://github.com/mongodb/mongo/commit/f5444a2b43281f502de681487b67ca5abcfb9f56

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