subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
if system == "Darwin": # macOS subprocess.run(["open", str(abs_path)], check=True) elif system == "Windows": subprocess.run(["start", "", str(abs_path)], shell=True, check=True) else: # Linux subprocess.run(["xdg-open", str(abs_path)], check=True) print(f"\n✓ HTML 报告已自动打开: {abs_path}", file=sys.stderr)- Confidence
- 95% confidence
- Finding
- The Windows branch uses `subprocess.run(..., shell=True)` with a path that can be influenced by `--output` or generated from data fields such as `category`. On Windows, `shell=True` routes execution through the command shell, so special characters in the path can lead to command injection or unintended command execution.
