T08 · Insecure Dependencies
- Location
package-lock.json:18- Finding
Dependency Lockfile Uses a Non-Official Package Registry
- Content
View full analysis
Vulnerability Details
File Location:
package-lock.json:18-21
Vulnerability Type: Third-party dependency supply-chain risk
Risk Level: MediumVulnerable Code
json "node_modules/ws": { "version": "8.19.0", "resolved": "https://registry.npmmirror.com/ws/-/ws-8.19.0.tgz", "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", "license": "MIT", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } }Technical Analysis
The lockfile directs npm to retrieve the runtime
wspackage fromregistry.npmmirror.com, a third-party mirror rather than the official npm registry. This introduces an additional supply-chain trust boundary for package availability and provenance.The recorded SHA-512 integrity value provides meaningful protection against package content differing from the artifact represented by the current lockfile. It does not, however, remove the risks of a maliciously modified lockfile, compromised lockfile-generation environment, mirror availability failure, or reliance on an organization that has not been explicitly approved by the consumer.
No evidence was found that the currently locked
wspackage is malicious. The issue is the avoidable use of an external dependency distribution source.Attack Path
- A user follows the installation instructions and runs
npm installornpm ci. - npm processes
package-lock.jsonand requests thewsarchive fromhttps://registry.npmmirror.com/. - An attacker would need to compromise the mirror, the dependency publication or lockfile-generation process, or modify the lockfile and its integrity value.
- A substituted dependency could subsequently be loaded by the following code at `scripts/websoc ...[truncated 1068 chars]
- A user follows the installation instructions and runs
- Remediation
View remediation
Remediation Suggestions
- Configure npm to use the official registry:
bash npm config set registry https://registry.npmjs.org/- Remove and regenerate the lockfile in a trusted environment:
bash rm -rf node_modules package-lock.json npm install- Verify that the regenerated
resolvedentry points tohttps://registry.npmjs.org/and retains a valid integrity hash. - Commit the reviewed lockfile and use
npm ciin CI/CD to enforce reproducible installation. - Pin or deliberately manage dependency upgrades rather than accepting unreviewed changes.
- Add dependency vulnerability and provenance checks to CI, such as
npm audit, lockfile policy validation, and software composition analysis. - Run dependency installation and application workloads with least privilege and avoid exposing unnecessary secrets to installation scripts or runtime processes.
- If the mirror is intentionally required, document its approval, ownership, synchronization policy, integrity controls, and incident-response process.
