Skip to content

Commit

Permalink
Fix eval exception (not so safe)
Browse files Browse the repository at this point in the history
  • Loading branch information
xgarrido committed Jan 20, 2025
1 parent 8350f4b commit 098a139
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pspipe/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def yaml_concat(loader, node):
return os.path.join(*loader.construct_sequence(node))


# ast.literal_eval is too restrictive here. Use eval given the user knows what he is doing using
# !eval tag in the yaml file
def yaml_eval(loader, node):
return eval(loader.construct_scalar(node))

Expand Down Expand Up @@ -151,7 +153,7 @@ def parse_time(t, human=True):
if do_replace:
try:
d[key] = eval(val)
except SyntaxError:
except:
d[key] = val
logging.debug(f"Configuration dict: {config_dict}")

Expand Down

0 comments on commit 098a139

Please sign in to comment.