daemon: update node commands to make use of shlex.quote for shell=True commands

This commit is contained in:
Blake Harnden 2022-06-10 12:12:25 -07:00
parent 9c265ab283
commit 60a48c7084

View file

@ -3,6 +3,7 @@ Defines the base logic for nodes used within core.
""" """
import abc import abc
import logging import logging
import shlex
import shutil import shutil
import threading import threading
from dataclasses import dataclass, field from dataclasses import dataclass, field
@ -702,7 +703,7 @@ class CoreNode(CoreNodeBase):
:return: node command :return: node command
""" """
if shell: if shell:
args = f'{BASH} -c "{args}"' args = f"{BASH} -c {shlex.quote(args)}"
return f"{VCMD} -c {self.ctrlchnlname} -- {args}" return f"{VCMD} -c {self.ctrlchnlname} -- {args}"
def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: