T08 · Insecure Dependencies
- Location
scripts/install-gate-mcp.sh:29- Finding
Unpinned Global Installation of a Third-Party npm Package
- Content
View full analysis
Vulnerability Details
File Location:
scripts/install-gate-mcp.sh, lines 29-43
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: MediumVulnerable Code
bash # Step 2: Install mcporter echo "[Step 2/4] Installing mcporter CLI..." if command -v mcporter &> /dev/null; then echo -e "${YELLOW}⚠ mcporter is already installed ($(mcporter --version))${NC}" read -p "Do you want to reinstall/update? (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Updating mcporter..." npm i -g mcporter fi else echo "Installing mcporter globally..." npm i -g mcporter fiThe same unsafe installation pattern is recommended in
SKILL.mdlines 32-36,README.mdlines 84-86, andreferences/scenarios.mdlines 66-70.SKILL.mdalso recommendsnpx mcporter --versionat line 36, which can download and execute the package when it is not already available locally.Technical Analysis
The installer requests
mcporterby package name without an exact version, lockfile, or integrity verification. Consequently, each installation resolves whatever package release the configured npm registry currently identifies as current. The installed artifact can therefore change after this skill has been audited.npm package installation may execute package lifecycle scripts. A compromised package publisher account, malicious future release, registry compromise, dependency compromise, or unsafe registry configuration could therefore result in arbitrary code execution during installation. Global installation also places the package in a shared executable location and exposes future invocations of
mcporterto the selected package implementation.The documentation's
npx mcporter --versionrecommendation creates a related execution path: depending on the local npm/npx version and configuration,npxmay retrieve and run a missing package rather than merely inspect an already verified instal ...[truncated 1704 chars]- Remediation
View remediation
Remediation Suggestions
-
Pin
mcporterto a reviewed exact version, for example:bash MCPORTER_VERSION="X.Y.Z" npm install --global --save-exact "mcporter@${MCPORTER_VERSION}" -
Verify the expected registry before installation and reject untrusted registry overrides:
bash EXPECTED_REGISTRY="https://registry.npmjs.org/" test "$(npm config get registry)" = "$EXPECTED_REGISTRY" || { echo "Unexpected npm registry" exit 1 } -
Validate the downloaded package using a reviewed integrity digest or a controlled lockfile. Where practical, download the package artifact first, verify its cryptographic digest, and install only the verified artifact.
-
Prefer a project-local dependency governed by
package-lock.jsonand installed withnpm ciinstead of modifying the global tool environment. -
Review package lifecycle scripts and use
--ignore-scriptsifmcporterdoes not legitimately require them. Test functionality before making this the default because some packages rely on installation scripts. -
Replace
npx mcporter --versionwith a check of a previously installed, version-pinned binary. Ifnpxmust be used for validation, usenpx --no-install mcporter --versionso that the check fails rather than downloading code. -
Update
SKILL.md,README.md, andreferences/scenarios.mdto use the same pinned and verified installation procedure. -
Advise users not to execute the installer as root or through
sudo; use the least-privileged account and a user-owned npm installation directory.
-
