fix: improve CLI argument validation for sensitive parameters with dot notation

This commit is contained in:
mrT23 2025-01-01 15:53:37 +02:00
parent d1caa0f15f
commit e2be1f1cee
No known key found for this signature in database
GPG key ID: D350490E39D5F5AD

View file

@ -66,9 +66,9 @@ class PRAgent:
if args:
for arg in args:
if arg.startswith('--'):
arg_word = arg.lower()
arg_word = arg_word.replace('__', '.') # replace double underscore with dot, e.g. --openai__key -> --openai.key
for forbidden_arg in forbidden_cli_args:
arg_word = arg.lower()
arg_word = arg_word.replace('__', '.') # replace double underscore with dot, e.g. --openai__key -> --openai.key
forbidden_arg_word = forbidden_arg.lower()
if '.' not in forbidden_arg_word:
forbidden_arg_word = '.' + forbidden_arg_word