subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def shutil_which(name: str) -> str | None: return subprocess.run( ["sh", "-lc", f"command -v {name}"], capture_output=True, text=True,- Confidence
- 98% confidence
- Finding
- The helper uses `sh -lc` with string interpolation to resolve a command path, which creates a shell-injection sink if the `name` argument is ever influenced by untrusted input. In this file the current callers pass hardcoded values, so immediate exploitability is limited, but the implementation is unsafe and could become exploitable if reused or modified later.
