T08 · Insecure Dependencies
Warning
- Location
- package.json:25
- Finding
- Incorrect and Unbounded npm Peer Dependency Creates Supply-Chain Risk## Vulnerability Details **File Location**: `package.json:25-27` **Vulnerability Type**: Insecure third-party dependency declaration **Risk Level**: Medium ### Vulnerable Code ```json "peerDependencies": { "gh": ">=2.0.0" } ``` ### Technical Analysis The application requires the official GitHub CLI system executable named `gh`, which it invokes through `execSync`. However, `package.json` represents this requirement as an npm peer dependency. An npm package named `gh` is not an equivalent declaration of the official system-level GitHub CLI. Modern npm versions can automatically resolve and install peer dependencies. Consequently, installing this project may retrieve registry code that is unnecessary for the scanner's documented operation. The version range is also unbounded (`>=2.0.0`), allowing any later version to satisfy the dependency. This provides no upper compatibility boundary or immutable integrity guarantee. If the registry package or a future release is malicious or compromised, its installation or lifecycle behavior could execute with the privileges of the user running npm. ### Attack Path 1. A user installs the skill through npm or a workflow that automatically resolves peer dependencies. 2. npm interprets `gh` as an npm registry package rather than as a requirement for the official GitHub CLI executable. 3. npm retrieves a version satisfying the unbounded `>=2.0.0` constraint. 4. If the resolved package or version has been compromised, attacker-controlled lifecycle or runtime code executes during installation or subsequent use. 5. That code runs with the installing user's privileges and can access files, credentials, environment variables, and network resources available to that user. ### Impact Assessment Exploitation depends on a malicious or compromised dependency being resolved. If that occurs, arbitrary code could execute with the privileges of the user installing the skill. The potential sc ...[truncated 300 chars]
- Remediation
- ## Remediation Suggestions 1. Remove `gh` from `peerDependencies`; an npm dependency is not the correct mechanism for requiring the official GitHub CLI. 2. Document installation of the official GitHub CLI separately, including trusted vendor installation sources. 3. At startup, validate that `gh` exists and fail safely with a clear message if it is unavailable. 4. Optionally invoke `gh --version` and enforce a supported version range. 5. If the implementation is changed to use a JavaScript GitHub API client, select a vetted package, pin compatible versions, commit a lockfile, and use npm integrity metadata and dependency scanning. 6. Disable unnecessary dependency lifecycle scripts in sensitive installation environments where operationally feasible.
