[SERVER-65027] Resharding commands permit extra options without returning an error Created: 29/Mar/22  Updated: 29/Oct/23  Resolved: 26/May/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 5.3.0, 5.0.0
Fix Version/s: 6.0.0-rc8, 5.0.10, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Nandini Bhartiya
Resolution: Fixed Votes: 0
Labels: sharding-nyc-subteam1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0, v5.0
Sprint: Sharding NYC 2022-05-30
Participants:
Story Points: 1

 Description   

The following commands are user-facing but specify {strict: false} for how they parse their input. This means if the operator misspells an argument to the commands or includes a non-existing one, they won't always get an error. We should change these commands to be {strict: true} to protect against this.


import pathlib
import yaml
 
def check_file(pathname):
    with open(pathname) as data:
        blob = yaml.safe_load(data)
    for (command, command_details) in blob.get("commands", {}).items():
        if not command_details.get("strict", True):
            yield command_details["command_name"]
 
for pathname in pathlib.Path().rglob("src/mongo/**/*.idl"):
    if str(pathname) == "src/mongo/idl/unittest.idl":
        continue
    for command in check_file(pathname):
        if not command.startswith("_"):
            print(f"{command} in {pathname}")



 Comments   
Comment by Githook User [ 31/May/22 ]

Author:

{'name': 'nandinibhartiyaMDB', 'email': 'nandini.bhartiya@mongodb.com', 'username': 'nandinibhartiyaMDB'}

Message: SERVER-65027: Ensure resharding commands are parsed strictly

(cherry picked from commit 9f2b96479c5dcc87fd2a54f72fd77a14609c6f36)
Branch: v6.0
https://github.com/mongodb/mongo/commit/5b5c358f6188be830cd255b1f53570eb3e6046ae

Comment by Githook User [ 31/May/22 ]

Author:

{'name': 'nandinibhartiyaMDB', 'email': 'nandini.bhartiya@mongodb.com', 'username': 'nandinibhartiyaMDB'}

Message: SERVER-65027: Ensure resharding commands are parsed strictly

(cherry picked from commit 9f2b96479c5dcc87fd2a54f72fd77a14609c6f36)
Branch: v5.0
https://github.com/mongodb/mongo/commit/925582ab4786cc5a25b5b82540c4b9e9227f429d

Comment by Githook User [ 24/May/22 ]

Author:

{'name': 'nandinibhartiyaMDB', 'email': 'nandini.bhartiya@mongodb.com', 'username': 'nandinibhartiyaMDB'}

Message: SERVER-65027: Ensure resharding commands are parsed strictly
Branch: master
https://github.com/mongodb/mongo/commit/9f2b96479c5dcc87fd2a54f72fd77a14609c6f36

Comment by Nandini Bhartiya [ 24/May/22 ]

Github PR: https://github.com/10gen/mongo/pull/5396

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