[SERVER-60817] setDefaultRWConcern accepts invalid write concern options Created: 19/Oct/21  Updated: 04/Feb/24  Resolved: 20/Jan/22

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

Type: Bug Priority: Major - P3
Reporter: Samyukta Lanka Assignee: Gabriel Marks
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-64309 Modify the server to support the set... Closed
is related to SERVER-61864 Replica set reconfiguration should ch... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Security 2022-01-24, Replication 2021-12-13, Replication 2021-12-27, Replication 2022-01-10
Participants:
Case:
Linked BF Score: 167

 Description   

setDefaultRWConcern accepts invalid write concern options like {w: "1"}, but the server will error with UnknownReplWriteConcern when trying to do an actual write.

We should either start accepting {w: "1"} or error at the time of setting the default read/write concern.



 Comments   
Comment by Githook User [ 20/Jan/22 ]

Author:

{'name': 'Gabriel Marks', 'email': 'gabriel.marks@mongodb.com', 'username': 'marksg07'}

Message: SERVER-60817 Check write concern string for validity
Branch: master
https://github.com/mongodb/mongo/commit/8ed3bf6a72756e175983f45bfad53368a7101b4b

Comment by Githook User [ 19/Jan/22 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: Revert "SERVER-60817 Check write concern string for validity"

This reverts commit 4c96930ccb001d91fd188380f80756c19f1ad3c1.
Branch: master
https://github.com/mongodb/mongo/commit/1983b3633c95ec71dc8070b8a864411374221d40

Comment by Githook User [ 18/Jan/22 ]

Author:

{'name': 'Gabriel Marks', 'email': 'gabriel.marks@mongodb.com', 'username': 'marksg07'}

Message: SERVER-60817 Check write concern string for validity
Branch: master
https://github.com/mongodb/mongo/commit/4c96930ccb001d91fd188380f80756c19f1ad3c1

Comment by Moustafa Maher [ 25/Oct/21 ]

Accepting numbers as string will conflict with the "custom write concern name" tags. 

Look at this example:

db.collection.insert( { id: "xyz", status: "A" }, { writeConcern: { w: "MultipleDC" } } )

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