subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
import subprocess cmd = ["python3", str(Path(__file__).parent / "trader.py"), "--buy", "--slug", slug, "--yes", "--size", str(round(size, 2)), "--confirm"] r = subprocess.run(cmd, capture_output=True, text=True, timeout=30) out = (r.stdout + r.stderr).strip() ok = any(x in out.lower() for x in ["matched", "delayed", "success", "order placed"]) return ok, out- Confidence
- 93% confidence
- Finding
- The code launches an external script to place trades using data-derived inputs, expanding the skill's authority from analysis into execution. Even though subprocess is invoked with an argument list rather than a shell, this is still dangerous because it delegates privileged financial actions to another file whose behavior is not constrained or validated here.
