DONT ACCEPT THIS FIX - RETHINK ARCHITECTURE - use below info for context but we should probalby just have the yaml be the main way to interact with this orchestrator instead of hidden settings in some py file overriding the dev.
File: galaxyscope.py
Labels: bug, cli, priority:medium
Description
In main(), config-file values are merged onto args using this check:
python# lines 2468–2472
if 'galaxyscope' in config_file_data:
for key, val in config_file_data['galaxyscope'].items():
arg_key = key.replace('-', '_')
if hasattr(args, arg_key) and getattr(args, arg_key) in (None, False, 0.0, ""):
setattr(args, arg_key, val)
The intent (per surrounding comments) is "CLI overrides YAML, YAML fills in what CLI didn't set." But argparse gives no way to distinguish "flag not passed" from "flag explicitly passed with its default value" — both look identical (0.0, False, "", etc.) once parsing is done.
Trigger: Run with a CLI flag explicitly set to its default, e.g. --max-risk-exposure 0.0, while a config file specifies max-risk-exposure: 25.0 under galaxyscope:. Since args.max_risk_exposure == 0.0 matches the sentinel tuple, the YAML value silently replaces the user's explicit CLI value.
Impact: Any CI/CD gate flag (--max-risk-exposure, --fail-on-secrets, etc.) explicitly set to a "falsy" value on the command line can be silently overridden by a checked-in config file, with no warning logged. This is particularly risky for the CI/CD gating flags, where an explicit opt-out could be silently reactivated.
Fix: Use argparse.SUPPRESS / track "was this flag explicitly provided" via parser.parse_known_args sentinels, or use a sentinel default (e.g. None) for every argument distinct from any valid value, checking only is None rather than truthiness.
DONT ACCEPT THIS FIX - RETHINK ARCHITECTURE - use below info for context but we should probalby just have the yaml be the main way to interact with this orchestrator instead of hidden settings in some py file overriding the dev.
File: galaxyscope.py
Labels: bug, cli, priority:medium
Description
In main(), config-file values are merged onto args using this check:
python# lines 2468–2472
if 'galaxyscope' in config_file_data:
for key, val in config_file_data['galaxyscope'].items():
arg_key = key.replace('-', '_')
if hasattr(args, arg_key) and getattr(args, arg_key) in (None, False, 0.0, ""):
setattr(args, arg_key, val)
The intent (per surrounding comments) is "CLI overrides YAML, YAML fills in what CLI didn't set." But argparse gives no way to distinguish "flag not passed" from "flag explicitly passed with its default value" — both look identical (0.0, False, "", etc.) once parsing is done.
Trigger: Run with a CLI flag explicitly set to its default, e.g. --max-risk-exposure 0.0, while a config file specifies max-risk-exposure: 25.0 under galaxyscope:. Since args.max_risk_exposure == 0.0 matches the sentinel tuple, the YAML value silently replaces the user's explicit CLI value.
Impact: Any CI/CD gate flag (--max-risk-exposure, --fail-on-secrets, etc.) explicitly set to a "falsy" value on the command line can be silently overridden by a checked-in config file, with no warning logged. This is particularly risky for the CI/CD gating flags, where an explicit opt-out could be silently reactivated.
Fix: Use argparse.SUPPRESS / track "was this flag explicitly provided" via parser.parse_known_args sentinels, or use a sentinel default (e.g. None) for every argument distinct from any valid value, checking only is None rather than truthiness.