T08 · Insecure Dependencies
- Location
scripts/imiva_mcp.py:12- Finding
Unpinned npm Package Is Executed with Sensitive Environment Access
- Content
View full analysis
dict: npx, token = require_runtime() env = os.environ.copy() env["MCP_TOKEN"] = token env["API_URL"] = os.environ.get("IMIVA_API_URL", os.environ.get("API_URL", DEFAULT_API_URL)) proc = subprocess.Popen( [npx, "-y", PACKAGE], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1, env=env, ) ``` The same unsafe mutable dependency reference appears in the example configuration: ```json { "mcpServers": { "imiva-ecommerce": { "command": "npx", "args": [ "-y", "@infimind/ecom-content-cli@latest" ], "env": { "MCP_TOKEN": "your-token-here", "API_URL": "https://imiva.ecpro.com" } } } } ``` ### Technical Analysis The helper invokes `npx -y @infimind/ecom-content-cli@latest` whenever an MCP operation is performed. The `latest` tag is mutable, so the code that executes at runtime can differ from the version that was reviewed. No exact version, lockfile, package integrity hash, or reproducible installation mechanism constrains the downloaded artifact. The subprocess is also given an environment created with `os.environ.copy()`. Consequently, the external npm package receives not only the required `MCP_TOKEN` and API endpoint but every environment variable visible to the Python process. These variables may contain unrelated cloud credentials, repository tokens, API keys, or other Agent secrets. Running a third-party package is necessary for the declared MCP functionality, but resolving a mut ...[truncated 1627 chars]- Remediation
View remediation
