Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
Catalog and Routing
-
3
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. Changing these commands to be {strict: true} would protect against this but should be weighed against driver's and/or server's ability to send these commands internally without needing to know which version of the server they are talking with.
- moveRange in src/mongo/s/request_types/move_range_request.idl
- refineCollectionShardKey in src/mongo/s/request_types/refine_collection_shard_key.idl
- enableSharding in src/mongo/s/request_types/sharded_ddl_commands.idl
- setAllowMigrations in src/mongo/s/request_types/set_allow_migrations.idl
- configureCollectionBalancing in src/mongo/s/request_types/configure_collection_balancing.idl
- clearJumboFlag in src/mongo/s/request_types/clear_jumbo_flag.idl
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}") |