T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:145
- Finding
- Unpinned npm Package Retrieval and Execution Through npx<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:145-161`, with additional instances at `SKILL.md:406` and `SKILL.md:455` **Vulnerability Type**: Unpinned third-party dependency retrieval and execution **Risk Level**: Medium ### Vulnerable Code ```bash # Run type-coverage (zero install — uses npx) echo "Running type-coverage analysis..." npx --yes type-coverage \ --detail \ --strict \ --ignore-files "**/*.d.ts" \ --ignore-files "**/__tests__/**" \ --ignore-files "**/*.test.ts" \ --ignore-files "**/*.spec.ts" \ 2>&1 | head -100 # For per-file breakdown npx --yes type-coverage \ --detail \ --strict \ --report-semantic-not-covered \ 2>&1 | grep -E "\.ts[x]?:" | sort -t: -k3 -rn | head -30 ``` Additional unpinned invocations include: ```yaml run: npx type-coverage --atLeast 85 --strict ``` ```bash npx type-coverage --strict ``` ### Technical Analysis The Skill directs the Agent to execute `type-coverage` through `npx` without specifying an exact, reviewed package version. If the package is not already installed locally, `npx` may contact the configured npm registry, download the currently resolved package release, and execute it with the invoking user's privileges. The `--yes` option further reduces safeguards by automatically approving package installation. Because the resolved package content can change after the Skill has been reviewed, the effective code executed by the Skill is not fully represented by the audited `SKILL.md` file. This behavior creates a software supply-chain trust boundary. A compromised npm publisher account, malicious package release, registry compromise, dependency compromise, or attacker-controlled npm registry configuration could cause arbitrary code to run during an otherwise local TypeScript audit. The network activity is related to dependency retrieval rather than a confirmed transfer of repository contents. No command in the audited file explicitly uploads source code, credentials, toke ...[truncated 1708 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add an audited, exact version of `type-coverage` to the project's development dependencies instead of resolving the latest available release at runtime: ```bash npm install --save-dev --save-exact type-coverage@<reviewed-version> ``` 2. Commit the package manifest and lockfile so the selected version and dependency integrity hashes are reviewable and reproducible. 3. Invoke only the locally installed dependency and prohibit fallback downloads: ```bash npx --no-install type-coverage --detail --strict ``` Alternatively: ```bash ./node_modules/.bin/type-coverage --detail --strict ``` 4. Remove `--yes` so unexpected installation is not silently authorized. 5. Install dependencies in a separate, controlled setup phase using a frozen lockfile: ```bash npm ci --ignore-scripts ``` If lifecycle scripts are required, review them before allowing their execution. 6. Run the audit in a sandbox with read-only repository access where practical, a minimal environment, no unnecessary secrets, restricted outbound networking, and no elevated privileges. 7. Clearly disclose that dependency installation may contact the npm registry. The current “Zero external API” language should not imply that execution is completely offline. 8. Apply the same pinned local invocation to the CI example at line 406 and migration command at line 455. ]]>
