[SERVER-32584] WriteConcernOptions::parse should verify that the "w" field is an acceptable string Created: 08/Jan/18  Updated: 27/Oct/23  Resolved: 09/Jan/18

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

Type: Task Priority: Major - P3
Reporter: Kaitlin Mahar Assignee: Backlog - Replication Team
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Participants:

 Description   

Currently it will parse and return an invalid string (for ex. "invalid"). We should check this rather than letting the invalid string propagate up.

Here: https://github.com/mongodb/mongo/blob/r3.6.1/src/mongo/db/write_concern_options.cpp#L140-L148

cc esha.maharishi



 Comments   
Comment by Esha Maharishi (Inactive) [ 09/Jan/18 ]

Hmm, I didn't know about the tags option to writeConcern either.

Ok, in that case mongos has no way to know what a valid 'w' argument is, and having it upconvert whatever is passed to 'w: majority' for metadata commands seems fine. Closing as Works as Designed.

Comment by Eric Milkie [ 08/Jan/18 ]

Unfortunately, no. I even filed a ticket a while ago than mentions that it's a problem that "majority" means something special. It means you can't have a tag called "majority"!

Comment by Kaitlin Mahar [ 08/Jan/18 ]

ah, didn't realize that you could use tags, we were thinking that the only valid string was probably "majority'.

Comment by Eric Milkie [ 08/Jan/18 ]

How will the WriteConcernOptions object know what the valid strings are? The tag sets could change for each new object that is parsed.

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