[SERVER-67878] Check BSON MD5 type in the validate command Created: 07/Jul/22  Updated: 29/Oct/23  Resolved: 29/Jul/22

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

Type: Task Priority: Major - P3
Reporter: Yuhong Zhang Assignee: Damian Wasilewicz
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-07-25, Execution Team 2022-08-08
Participants:

 Description   

Currently when we validate BSON Binary data type, we simply skip over it without further checking if the content comply to the specification. Valid MD5s are 16-byte long but in BSON documents they can be arbitrary lengths and we do not check it. We need to make the validate command to catch this inconsistency while not for regular writes.

We can already create BSON documents with an invalid MD5 in the shell by 

> db.test.insert({u: BinData(5, "deadbeaf")})
WriteResult({ "nInserted" : 1 }) 

We should also add unit tests for this.



 Comments   
Comment by Githook User [ 28/Jul/22 ]

Author:

{'name': 'Damian Wasilewicz', 'email': 'damian.wasilewicz@mongodb.com', 'username': 'DamianWasilewicz'}

Message: SERVER-67878 Check BSON MD5 type in the validate command
Branch: master
https://github.com/mongodb/mongo/commit/7e7eb67b22e842dd4041369bc5d262025a7c692c

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