diff --git a/ai_agents/agents/examples/voice-assistant-nodejs/tenapp/ten_packages/extension/main_nodejs/tools/run_script.py b/ai_agents/agents/examples/voice-assistant-nodejs/tenapp/ten_packages/extension/main_nodejs/tools/run_script.py index 616bc1b093..8f108e9835 100644 --- a/ai_agents/agents/examples/voice-assistant-nodejs/tenapp/ten_packages/extension/main_nodejs/tools/run_script.py +++ b/ai_agents/agents/examples/voice-assistant-nodejs/tenapp/ten_packages/extension/main_nodejs/tools/run_script.py @@ -5,6 +5,7 @@ # See the LICENSE file for more information. # import argparse +import shlex import subprocess import sys import os @@ -15,7 +16,8 @@ def run_cmd(cmd: str, env: dict[str, str] | None = None) -> int: if env is None: env = os.environ.copy() print(f"Running: {cmd}") - result = subprocess.run(cmd, shell=True, check=True, env=env) + # Use shell=False to avoid shell injection vulnerabilities + result = subprocess.run(shlex.split(cmd), shell=False, check=True, env=env) return result.returncode