subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
env = dict(os.environ) if rustc: env["RUSTC"] = rustc result = subprocess.run([cargo, "build", "--release"], capture_output=True, text=True, env=env) if result.returncode != 0: sys.exit(f"Build failed:\n{result.stderr}")- Confidence
- 86% confidence
- Finding
- The script executes `cargo` from an environment-controlled value (`CARGO`) or from PATH-derived resolution, which can cause execution of an unintended binary if the environment is malicious or compromised. In CI or automation contexts, this becomes a code-execution primitive because the script trusts external tool selection without validating the executable path.
