[SERVER-56743] Reintroduce validation for no $-prefixed fields in _id Created: 07/May/21  Updated: 29/Oct/23  Resolved: 07/May/21

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

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

Issue Links:
Depends
Documented
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Linked BF Score: 151

 Description   

As part of SERVER-49117, validation for the _id field ensuring that it is not possible to insert a document with an _id field that is an object containing $-prefixed fields was removed. This code (https://github.com/mongodb/mongo/blob/master/src/mongo/db/repl/oplog.cpp#L1360-L1366) to update the oplog calls an update on the _id field along a path that still validates that _id, which caused BF-21074. The simple solution is to add the _id validation back here: https://github.com/mongodb/mongo/commit/995f0406d72b1a15d18b2df2d8c0afa0c4c5b774#diff-5295b5000db7b3711a31f86ebbe374e929270da88b36b20d3459c9b1d4f48d17R135-R136



 Comments   
Comment by Githook User [ 07/May/21 ]

Author:

{'name': 'Alya Berciu', 'email': 'alyacarina@gmail.com', 'username': 'alyacb'}

Message: SERVER-56743 Reintroduce validation for no $-prefixed fields in _id
Branch: master
https://github.com/mongodb/mongo/commit/61765594369bd1592ac620074bebdc6e16444f3c

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