diff options
-rw-r--r-- | src/live/ogOperations.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index a692c01..b1aa731 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -381,6 +381,9 @@ class OgLiveOperations: cmd = request.getrun() is_inline = request.get_inline() + if not cmd: + raise OgError("No command provided for shell run") + self._restartBrowser(self._url_log) if is_inline: @@ -389,6 +392,9 @@ class OgLiveOperations: cmds = shlex.split(cmd) shell_path = '/opt/opengnsys/shell/' + if not cmds: + raise OgError("Parsed shell command list is empty") + try: shell_path_files = os.listdir(shell_path) except OSError as e: @@ -404,6 +410,8 @@ class OgLiveOperations: else: raise OgError(f'Script {cmds[0]} not found in {shell_path}') + if not os.path.isfile(cmds[0]) or not os.access(cmds[0], os.X_OK): + raise OgError(f"Command '{cmds[0]}' is not a valid executable") try: ogRest.proc = subprocess.Popen( cmds, |