subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def screenshot_with_playwright(html_path: str, output: str, width: int, height: int) -> bool: try: result = subprocess.run( ["npx", "--yes", "playwright", "screenshot", "--browser", "chromium", "--viewport-size", f"{width},{height}",- Confidence
- 92% confidence
- Finding
- The code invokes external tooling via subprocess to run `npx playwright screenshot` on attacker-influenced HTML and an attacker-controlled output path. Although it avoids shell injection by passing an argument list, this still expands the attack surface by executing external binaries and rendering untrusted HTML in a browser engine, which can trigger network access, local file exposure in the rendered page, or dependency-related risk from the Node/Playwright toolchain.
