subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
''' def run(cmd, capture=True, check=True): result = subprocess.run(cmd, shell=True, capture_output=capture, text=True) if check and result.returncode != 0: return None, result.stderr return result.stdout.strip() if capture else None, None- Confidence
- 94% confidence
- Finding
- The helper wraps subprocess.run with shell=True, which is inherently dangerous because any future caller that incorporates untrusted input into cmd can trigger shell metacharacter interpretation and command injection. In this file the current call sites are fixed strings, so there is no immediate exploit path shown, but embedding an unsafe execution primitive in a setup script materially increases risk and is correctly flagged as a vulnerability pattern.
