From 60a48c7084d249cdb8061bdd13a3f7c9e50f677e Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 10 Jun 2022 12:12:25 -0700 Subject: [PATCH] daemon: update node commands to make use of shlex.quote for shell=True commands --- daemon/core/nodes/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/core/nodes/base.py b/daemon/core/nodes/base.py index 404e9ab2..5866b5e2 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -3,6 +3,7 @@ Defines the base logic for nodes used within core. """ import abc import logging +import shlex import shutil import threading from dataclasses import dataclass, field @@ -702,7 +703,7 @@ class CoreNode(CoreNodeBase): :return: node command """ if shell: - args = f'{BASH} -c "{args}"' + args = f"{BASH} -c {shlex.quote(args)}" return f"{VCMD} -c {self.ctrlchnlname} -- {args}" def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: