subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def _get_version_via_npx(slug: str) -> str | None: """L3: 通过 npx 临时下载 clawhub 执行(无需全局安装,需要 Node.js)""" import subprocess result = subprocess.run( ["npx", "--yes", "clawhub@latest", "inspect", slug, "--json"], capture_output=True, text=True, timeout=60, )- Confidence
- 97% confidence
- Finding
- This code executes `npx --yes clawhub@latest`, which downloads and runs the latest package from the registry at runtime. That creates a supply-chain execution risk: a compromised package, dependency, registry response, or MITM in the Node ecosystem could result in arbitrary code execution on the user's machine during a mere 'environment check'.
