T08 · Insecure Dependencies
Warning
- Location
- package.json:14
- Finding
- Unbounded Global Installation of a Third-Party CLI Dependency<![CDATA[ ## Vulnerability Details **File Locations**: - `package.json:14-16` - `SKILL.md:5-7` - `README.md:7-12` - `README.md:157-160` **Vulnerability Type**: Unpinned third-party dependency and global package installation **Risk Level**: Medium ### Vulnerable Code `package.json:14-16`: ```json "peerDependencies": { "@mermaid-js/mermaid-cli": ">=10.0.0" } ``` `SKILL.md:5-7`: ```markdown ## Requirements - `@mermaid-js/mermaid-cli` (`npm install -g @mermaid-js/mermaid-cli`) ``` `README.md:7-12`: ```markdown ### Prerequisites Install the Mermaid CLI globally: ```bash npm install -g @mermaid-js/mermaid-cli ``` ``` The troubleshooting section repeats the same installation approach: ```markdown **Issue:** `mmdc: command not found` **Solution:** Install globally: `npm install -g @mermaid-js/mermaid-cli` ``` ### Technical Analysis The project accepts any version of `@mermaid-js/mermaid-cli` at or above version 10 and instructs users to install the latest available release globally. There is no exact version pin, lockfile, or integrity verification mechanism. An npm package installation can execute package lifecycle scripts. Consequently, the behavior executed during installation is not limited to the source reviewed in this project. A future compromised, malicious, or unexpectedly incompatible version satisfying `>=10.0.0` could be selected without any change to the audited repository. Global installation increases the potential scope because it modifies the user's global npm environment and exposes the `mmdc` executable system-wide for that user. The package name is consistent with the declared Mermaid functionality, and the reviewed project contains no evidence that the dependency is currently malicious. Exploitation therefore depends on compromise or malicious publication of an accepted upstream release. ### Attack Path 1. An attacker compromises the upstream npm package, a maintainer account, or the package publication pipeline. 2. The attacke ...[truncated 1154 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `@mermaid-js/mermaid-cli` to an exact, reviewed version rather than using `>=10.0.0`. 2. Declare the CLI as a project-local dependency or development dependency instead of recommending global installation. 3. Commit a package lockfile and use `npm ci` so installations resolve to reviewed package versions and integrity hashes. 4. Invoke the pinned local binary through an npm script or an explicit path such as `node_modules/.bin/mmdc`. 5. Update `README.md` and `SKILL.md` to remove unversioned global installation commands. 6. Review dependency updates before changing the pinned version, including package provenance, release changes, transitive dependencies, and lifecycle scripts. 7. Where supported, use npm provenance verification and a trusted registry configuration in the release or deployment process. 8. Run the renderer with least privilege and isolate it from secrets and sensitive files when processing untrusted Mermaid input. ]]>
