Commit 236ff4d6 authored by Spyros Argyropoulos's avatar Spyros Argyropoulos Committed by Christian Gutschow
Browse files

fix

parent 11cfbe6b
Pipeline #2601431 passed with stages
in 1 minute and 1 second
...@@ -39,9 +39,8 @@ def _read_param_from_jo(jo, names, ignore_case=False): ...@@ -39,9 +39,8 @@ def _read_param_from_jo(jo, names, ignore_case=False):
# See https://gitlab.cern.ch/atlas-physics/pmg/mcjoboptions/-/issues/98 # See https://gitlab.cern.ch/atlas-physics/pmg/mcjoboptions/-/issues/98
def _read_param_from_jo_withDict(jo, type, param): def _read_param_from_jo_withDict(jo, type, param):
locals = {type: argparse.Namespace()} locals = {type: argparse.Namespace()}
skipLines=["os.system", "subprocess.call", "subprocess.Popen"] # skip lines containing these calls
for line in jo.splitlines(): for line in jo.splitlines():
if any(x in line for x in skipLines): continue if "os.system" or "subprocess.call" or "subprocess.Popen" in line: continue # for security
try: try:
exec(line, {}, locals) exec(line, {}, locals)
except: except:
...@@ -56,11 +55,9 @@ def _env_set(jo, param): ...@@ -56,11 +55,9 @@ def _env_set(jo, param):
os.environ.clear() os.environ.clear()
# dictionary to store environment variables # dictionary to store environment variables
locals = dict() locals = dict()
# skip lines containing these calls
skipLines=["os.system", "subprocess.call", "subprocess.Popen"]
# Execute jO # Execute jO
for line in jo.splitlines(): for line in jo.splitlines():
if any(x in line for x in skipLines): continue if "os.system" or "subprocess.call" or "subprocess.Popen" in line: continue # for security
try: try:
exec(line.strip(), globals(), locals) exec(line.strip(), globals(), locals)
except: except:
......
Markdown is supported
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