[SERVER-56479] Server logging of BSON containing BinData does not roundtrip Created: 29/Apr/21  Updated: 29/Oct/23  Resolved: 20/Jul/21

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

Type: Bug Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Security 2021-07-26
Participants:

 Description   

When the server logs a bson object containing BinData (at least of type 0 such as the lsid.uid field), the hex encoded value is not quoted:

{ 
  lsid: { 
    id: UUID("445f7935-6df6-492e-b078-00e030e4ffea"), 
    uid: BinData(0, E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855)
  }
}

That (extended) json cannot be fed back into the shell.

For comparison, the shell does output the BinData with quotes:

config> db.system.sessions.find().pretty()
{
	"_id" : {
		"id" : UUID("eef34f2c-612f-475d-846b-67b221f0081c"),
		"uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
	},
	"lastUse" : ISODate("2021-04-29T14:24:06.339Z")
}

I also expect that outputting hex encoded BinData instead of base64 encoded BinData would also be a problem for round tripping with the shell? Maybe this was an intentional decision and not an oversight, but it's certainly useful for development to be able to paste the server output into a the javascript mongo shell.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 20/Jul/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-56479 Server logging of BSON containing BinData does not roundtrip
Branch: master
https://github.com/mongodb/mongo/commit/4b32d5137c51d955e57c0be11ebd18c3c05947f3

Comment by Githook User [ 20/Jul/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-56479 Server logging of BSON containing BinData does not roundtrip
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/344208d3a28cca043e4aa6b79d3b5bbb4ba613e6

Generated at Thu Feb 08 05:39:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.