Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def enable_cors(request, response):

async def start_vue_dev_server():
await asyncio.create_subprocess_shell(
"npm run dev", stdout=sys.stdout, stderr=sys.stderr, cwd=MAGMA_PATH
"npm run dev", stdout=sys.stdout, stderr=sys.stderr, cwd=MAGMA_PATH, shell=True
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using shell=True with asyncio.create_subprocess_shell is redundant since create_subprocess_shell already executes commands through the shell by default. Consider using asyncio.create_subprocess_exec with the command split into arguments for better security and consistency with the other subprocess calls.

Suggested change
"npm run dev", stdout=sys.stdout, stderr=sys.stderr, cwd=MAGMA_PATH, shell=True
"npm run dev", stdout=sys.stdout, stderr=sys.stderr, cwd=MAGMA_PATH

Copilot uses AI. Check for mistakes.

)
logging.info("VueJS development server is live.")

Expand Down Expand Up @@ -256,15 +256,15 @@ def list_str(values):
if args.uiDevHost:
if not os.path.exists(f"{MAGMA_PATH}/dist"):
logging.info("Building VueJS front-end.")
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True)
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True, shell=True)
logging.info("VueJS front-end build complete.")
app_svc.application.on_response_prepare.append(enable_cors)

if args.build:
if len(os.listdir(MAGMA_PATH)) > 0:
logging.info("Building VueJS front-end.")
subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True)
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True)
subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True, shell=True)
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True, shell=True)
Comment on lines +259 to +267
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using shell=True with a list of arguments can lead to unexpected behavior and potential security issues. When using shell=True, the command should be passed as a string, not a list. Either change to string format or remove shell=True and handle Windows compatibility differently.

Copilot uses AI. Check for mistakes.

Comment on lines +259 to +267
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using shell=True with a list of arguments can lead to unexpected behavior and potential security issues. When using shell=True, the command should be passed as a string, not a list. Either change to string format or remove shell=True and handle Windows compatibility differently.

Copilot uses AI. Check for mistakes.

logging.info("VueJS front-end build complete.")
else:
logging.warning(
Expand Down