diff --git a/datajob/datajob.py b/datajob/datajob.py index 8139f4a..a0ed530 100644 --- a/datajob/datajob.py +++ b/datajob/datajob.py @@ -4,6 +4,7 @@ from pathlib import Path import typer +import shlex from datajob.package import wheel @@ -68,4 +69,5 @@ def call_cdk(command: str, args: list = None, extra_args: list = None): full_command = " ".join(["cdk", command] + args + extra_args) print(f"cdk command:" f" {full_command}") # todo - shell=True is not secure - subprocess.call(full_command, shell=True) + # subprocess.call(full_command, shell=True) + subprocess.check_call(shlex.split(full_command)) diff --git a/datajob/package/wheel.py b/datajob/package/wheel.py index c146847..a3e8264 100644 --- a/datajob/package/wheel.py +++ b/datajob/package/wheel.py @@ -1,5 +1,6 @@ import subprocess from pathlib import Path +import shlex from datajob import logger @@ -20,7 +21,7 @@ def create(project_root): cmd = f"cd {project_root}; python setup.py bdist_wheel" print(f"wheel command: {cmd}") # todo - shell=True is not secure - subprocess.call(cmd, shell=True) + subprocess.check_call(shlex.split(cmd)) else: raise DatajobPackageWheelError( f"no setup.py file detected in project root {project_root}. "