[SERVER-73463] Investigate IDL type serializers not being treated as free functions Created: 30/Jan/23  Updated: 06/Feb/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sara Golemon Assignee: Backlog - Security Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Security
Operating System: ALL
Participants:

 Description   

Given an IDL type definition like:

  mytype:
  bson_serialization_type: any
  cpp_type: MyType
  deserializer: "mongo::parseMyType"
  serializer: "::mongo::serializeMyType"

Serialization will call `mongo::serializeMyType(const MyType& val, StringData fieldName, BSONObjBuilder* builder)`, however when the serialization type is narrowed, such as the following, the "::" prefix denoting a free function is ignored, and the type is serialized as `myType.serializeMyType(StringData fieldName, BSONObjBuilder* builder) const`.

  mytype:
  bson_serialization_type: [int, long, decimal, double]
  cpp_type: MyType
  deserializer: "mongo::parseMyType"
  serializer: "::mongo::serializeMyType"

The behavior current exhibited by the `any` case at top is correct, while the more narrow type below is not.


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