T08 · Insecure Dependencies
- Location
scripts/imiva_mcp.py:13- Finding
Unpinned npm Package Is Automatically Downloaded and Executed with a Sensitive Token
- Content
View full analysis
Vulnerability Details
File Locations:
scripts/imiva_mcp.py:13scripts/imiva_mcp.py:47-60references/mcp-config.example.json:3-11SKILL.md:103-114
Vulnerability Type: Supply-chain risk caused by automatic execution of an unpinned third-party dependency
Risk Level: MediumVulnerable Code
scripts/imiva_mcp.py:13:python PACKAGE = "@infimind/ecom-content-cli@latest"scripts/imiva_mcp.py:47-60:python def invoke(method: str, params: dict | None = None) -> 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, )references/mcp-config.example.json:3-11:json "imiva-ecommerce": { "command": "npx", "args": [ "-y", "@infimind/ecom-content-cli@latest" ], "env": { "MCP_TOKEN": "your-token-here", "API_URL": "https://imiva.ecpro.com" } }SKILL.md:103-114: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 project invokes
npxwith the-yoption and the mutable package specifier@infimind/ecom-content-cli@latest. This causes npm to resolve and, when necessary, download and execute whichever package version is associated with thelatestdistribution tag at execution time.Because no exact package version, lockfile, or integrity digest is enforc ...[truncated 2547 chars]
- Remediation
View remediation
Remediation Suggestions
-
Replace the
latesttag with an exact, reviewed package version, for example:python PACKAGE = "@infimind/ecom-content-cli@1.2.3"Apply the same exact version in
SKILL.mdandreferences/mcp-config.example.json. -
Install dependencies through a committed lockfile and use a deterministic installation mechanism such as
npm ci. Preserve and verify npm integrity metadata. -
Establish a controlled dependency-upgrade process that includes release review, security scanning, changelog inspection, and testing before changing the pinned version.
-
Avoid noninteractive installation and execution with
npx -yin security-sensitive workflows. Prefer a previously installed and verified local executable. -
Replace
os.environ.copy()with an allowlisted environment containing only values required by the MCP package. For example:python env = { "PATH": os.environ.get("PATH", ""), "MCP_TOKEN": token, "API_URL": os.environ.get( "IMIVA_API_URL", os.environ.get("API_URL", DEFAULT_API_URL), ), } -
Run the dependency in a restricted environment with minimal filesystem permissions, limited network access, and a dedicated low-privilege account where practical.
-
Use a narrowly scoped and revocable MCP token. Monitor account activity and rotate the token if dependency compromise is suspected.
-
