subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
} try: proc = subprocess.run( ["python", "-m", "pytest", str(test_file), "-v", "--tb=short"], capture_output=True, text=True,- Confidence
- 96% confidence
- Finding
- The script generates a pytest file from user-controlled requirement/keyword inputs and then executes it with `python -m pytest`. Because the generated test code interpolates identifiers such as module/class/function names derived from repository contents without sanitization, an attacker who can influence the scanned codebase or inputs may cause arbitrary Python code to be written and executed. In this skill context, executing tests is expected, but doing so on auto-generated code substantially increases risk.
