From 9c87b67aa066e89d935994d99962d2c26efa2825 Mon Sep 17 00:00:00 2001 From: RinCodeForge927 Date: Wed, 31 Dec 2025 22:48:15 +0700 Subject: [PATCH] Hardened the Application's Attack Surface through Least Privilege Principle --- scripts/start_web.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/start_web.py b/scripts/start_web.py index 533124f88..104a4733d 100644 --- a/scripts/start_web.py +++ b/scripts/start_web.py @@ -141,10 +141,11 @@ def start_frontend(): print_flush("📦 Installing frontend dependencies...") print_flush(" This may take a few minutes, please wait...") try: + npm_cmd = shutil.which("npm") or "npm" process = subprocess.Popen( - "npm install", + [npm_cmd, "install"], cwd=web_dir, - shell=True, + shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, @@ -211,10 +212,11 @@ def start_frontend(): if os.name == "nt": env["PYTHONLEGACYWINDOWSSTDIO"] = "0" + npm_cmd = shutil.which("npm") or "npm" frontend_process = subprocess.Popen( - f"npm run dev -- -p {frontend_port}", + [npm_cmd, "run", "dev", "--", "-p", str(frontend_port)], cwd=web_dir, - shell=True, + shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,