T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:18
- Finding
- Unpinned Third-Party Dependencies and Mutable CDN Resource<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 18-26 and 125-129 **Vulnerability Type**: Unpinned npm dependencies and CDN resource without Subresource Integrity **Risk Level**: Medium ### Vulnerable Code ```markdown **npm:** ```bash npm install chart.js ``` **CDN (Script Tag):** ```html <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> ``` ``` The time-scale guidance also references dependencies without specifying reviewed versions: ```javascript import moment from 'moment'; import 'chartjs-adapter-moment'; // Then configure scales with type: 'time' ``` ### Technical Analysis The installation command does not pin Chart.js to an exact reviewed version. The CDN URL likewise omits a version and Subresource Integrity hash, meaning the JavaScript returned by the external service can change after the Skill has been audited. The date-adapter guidance also fails to prescribe exact versions for `moment` and `chartjs-adapter-moment`. This creates a supply-chain trust gap: the code ultimately installed or executed is determined by mutable registry metadata or CDN responses rather than by immutable, reviewed artifacts. Normal upstream updates are not inherently malicious, but compromise of a package maintainer account, npm publication process, CDN, DNS path, or upstream release could cause altered code to be delivered. ### Attack Path 1. An attacker compromises an upstream package publication account, distribution service, or other part of the dependency supply chain. 2. The attacker publishes or serves a malicious version under one of the unpinned dependency names or mutable CDN paths. 3. A user follows the Skill's installation or HTML-generation instructions. 4. The package manager resolves the unpinned dependency to the affected release, or the browser downloads the modified CDN script. 5. The malicious content executes: - Package lifecycle code may run with the privileges of the user performing installation. - Bundl ...[truncated 958 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every npm dependency to an exact reviewed version rather than a floating range: ```bash npm install --save-exact chart.js@<reviewed-version> npm install --save-exact moment@<reviewed-version> chartjs-adapter-moment@<reviewed-version> ``` 2. Commit and enforce a package lockfile containing resolved versions and integrity hashes. Use deterministic installation in automated environments: ```bash npm ci ``` 3. Replace the mutable CDN URL with an exact version and a verified Subresource Integrity hash: ```html <script src="https://cdn.jsdelivr.net/npm/chart.js@<exact-version>/dist/chart.umd.min.js" integrity="sha384-<verified-hash>" crossorigin="anonymous"></script> ``` 4. Add an appropriate Content Security Policy that restricts permitted script sources. Where practical, self-host the reviewed library artifact. 5. Enable dependency vulnerability scanning and update pinned versions through a controlled review process. Verify package provenance, integrity, ownership, and release notes before accepting upgrades. 6. Document that generated HTML must not interpolate untrusted input directly into JavaScript or markup, especially when dependency code runs in a page containing sensitive application data. ]]>
