Commit 11cfbe6b authored by Spyros Argyropoulos's avatar Spyros Argyropoulos Committed by Christian Gutschow
Browse files

Skip execution of lines containing subprocess calls

parent da4f1801
......@@ -39,8 +39,9 @@ def _read_param_from_jo(jo, names, ignore_case=False):
# See https://gitlab.cern.ch/atlas-physics/pmg/mcjoboptions/-/issues/98
def _read_param_from_jo_withDict(jo, type, param):
locals = {type: argparse.Namespace()}
skipLines=["os.system", "subprocess.call", "subprocess.Popen"] # skip lines containing these calls
for line in jo.splitlines():
if "os.system" in line: continue # for security
if any(x in line for x in skipLines): continue
try:
exec(line, {}, locals)
except:
......@@ -55,8 +56,11 @@ def _env_set(jo, param):
os.environ.clear()
# dictionary to store environment variables
locals = dict()
# skip lines containing these calls
skipLines=["os.system", "subprocess.call", "subprocess.Popen"]
# Execute jO
for line in jo.splitlines():
if any(x in line for x in skipLines): continue
try:
exec(line.strip(), globals(), locals)
except:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment