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
9 changes: 1 addition & 8 deletions dash/development/component_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import json
import sys
import subprocess
import shlex
import os
import argparse
import shutil
Expand Down Expand Up @@ -56,8 +55,6 @@

project_shortname = project_shortname.replace("-", "_").rstrip("/\\")

is_windows = sys.platform == "win32"

# Get path to extract-meta.js using importlib.resources
try:
# Python 3.9+
Expand All @@ -83,18 +80,14 @@
# Ensure local node modules is used when the script is packaged.
env["MODULES_PATH"] = os.path.abspath("./node_modules")

cmd = shlex.split(
f'node {extract_path} "{ignore}" "{reserved_patterns}" {components_source}',
posix=not is_windows,
)
cmd = ["node", extract_path, ignore, reserved_patterns, components_source]

proc = subprocess.Popen( # pylint: disable=consider-using-with
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=is_windows,
env=env,
)

Check failure on line 90 in dash/development/component_generator.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

LLMs running this code with faulty CLI arguments can escape from shell sandboxes. Refactor this code to validate untrusted data before passing them to OS commands.

See more on https://sonarcloud.io/project/issues?id=plotly_dash&issues=AaAbG49isbbbzkBBNXlR&open=AaAbG49isbbbzkBBNXlR&pullRequest=3621
out, err = proc.communicate()
status = proc.poll()

Expand Down
Loading