Merge pull request from GHSA-hv5m-3rp9-xcpf
* Remove eval of API input * Remove unnecessary eval/exec for security * Use ast.literal_eval * Use ast.literal_eval --------- Co-authored-by: oobabooga <112222186+oobabooga@users.noreply.github.com>
This commit is contained in:
parent
d2ea925fa5
commit
16a3a5b039
5 changed files with 15 additions and 13 deletions
|
@ -152,9 +152,9 @@ args_defaults = parser.parse_args([])
|
|||
# Deprecation warnings for parameters that have been renamed
|
||||
deprecated_dict = {}
|
||||
for k in deprecated_dict:
|
||||
if eval(f"args.{k}") != deprecated_dict[k][1]:
|
||||
if getattr(args, k) != deprecated_dict[k][1]:
|
||||
print(f"Warning: --{k} is deprecated and will be removed. Use --{deprecated_dict[k][0]} instead.")
|
||||
exec(f"args.{deprecated_dict[k][0]} = args.{k}")
|
||||
setattr(args, deprecated_dict[k][0], getattr(args, k))
|
||||
|
||||
# Deprecation warnings for parameters that have been removed
|
||||
if args.cai_chat:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue