subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
script_path = os.path.join(output_dir, "_render.js") with open(script_path, "w") as f: f.write(script) subprocess.run(["node", script_path], capture_output=True, timeout=30) return sorted(glob.glob(os.path.join(output_dir, "slide_*.png")))- Confidence
- 86% confidence
- Finding
- The code generates a JavaScript file containing unescaped file-path data and executes it with Node. If pdf_path or output_dir contain characters such as quotes or backslashes, they can break out of the intended JavaScript string literal and alter the script, potentially leading to arbitrary code execution in the Node/Playwright context.
