subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
env = os.environ.copy() if "NODE_PATH" not in env: try: npm_global = subprocess.run( "npm root -g", capture_output=True, text=True, timeout=10, shell=True,- Confidence
- 89% confidence
- Finding
- The code executes `npm root -g` with `shell=True`, which unnecessarily invokes a shell even though no shell features are needed. In hostile environments, PATH or shell behavior can be manipulated so a different executable or shell context is used, increasing command-execution risk for a tool that may run on developer machines.
