subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def download_file(url: str, output_path: str) -> str: Path(output_path).parent.mkdir(parents=True, exist_ok=True) cmd = ["curl", "-s", "-S", "-L", "-o", output_path, "--max-time", "300", url] result = subprocess.run(cmd, capture_output=True, text=True) if result.returncode != 0: print(f"Download failed: {result.stderr}", file=sys.stderr) sys.exit(1)- Confidence
- 91% confidence
- Finding
- result = subprocess.run(cmd, capture_output=True, text=True)
