From f126c54169b6c7a98c48cce06fac305b42be1d24 Mon Sep 17 00:00:00 2001 From: TheBossMagnus Date: Wed, 21 Feb 2024 19:52:41 +0100 Subject: [PATCH] Fix Dangerous default value DEFAULT_CONFIG (builtins.dict) as argument Signed-off-by: TheBossMagnus --- src/config_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config_handler.py b/src/config_handler.py index d918678..1a097dc 100644 --- a/src/config_handler.py +++ b/src/config_handler.py @@ -13,8 +13,9 @@ def create_config(): logging.error("ERROR: Unable to create the config.json in %s. Try running as administrator", os.getcwd()) sys.exit(1) -def validate_config(config, default_config=DEFAULT_CONFIG): +def validate_config(config, default_config): """Check if all the fields are present and are of the correct type""" + if not isinstance(config, dict): raise ValueError("Config must be a dictionary") for key, default_value in default_config.items():