subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def has_self_test(fp): r = subprocess.run([sys.executable, fp, "self-test"], capture_output=True, text=True, timeout=30) return r.returncode == 0 and "PASS" in r.stdout- Confidence
- 96% confidence
- Finding
- This helper executes an arbitrary Python file discovered in the target product folder as part of verification. In CI or other trusted automation contexts, running untrusted repository code for a "self-test" can lead to arbitrary code execution, secret exfiltration, filesystem tampering, or network access under the CI runner's privileges. The use of an argument list avoids shell injection, but it does not mitigate the core risk of executing attacker-controlled code.
