T08 · Insecure Dependencies
Warning
- Location
- package-lock.json:13
- Finding
- Runtime Dependencies Retrieved from a Third-Party Mirror over Plaintext HTTP## Vulnerability Details **File Location**: `package-lock.json:13-20` **Vulnerability Type**: Insecure dependency source and transport **Risk Level**: Medium ### Vulnerable Code ```json "node_modules/@mixmark-io/domino": { "version": "2.2.0", "resolved": "http://mirrors.tencentyun.com/npm/@mixmark-io/domino/-/domino-2.2.0.tgz", "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==", "license": "BSD-2-Clause" }, "node_modules/turndown": { "version": "7.2.2", "resolved": "http://mirrors.tencentyun.com/npm/turndown/-/turndown-7.2.2.tgz", "integrity": "sha512-1F7db8BiExOKxjSMU2b7if62D/XOyQyZbPKq/nUwopfgnHlqXHqQ0lvfUTeUIr1lZJzOPFn43dODyMSIfvWRKQ==", "license": "MIT", "dependencies": { "@mixmark-io/domino": "^2.2.0" } } ``` ### Technical Analysis The lockfile directs npm to download both runtime packages from a third-party mirror using unauthenticated, unencrypted HTTP. The documented installation procedure executes `npm install --omit=dev`, so these URLs participate directly in the normal installation path. Plaintext HTTP permits an on-path party to observe, block, redirect, or modify dependency responses. The included SHA-512 integrity values materially mitigate package substitution because npm should reject an archive whose contents do not match the lockfile. Consequently, arbitrary package replacement through a simple man-in-the-middle attack is not expected to succeed while integrity verification remains enabled and the lockfile remains trusted. Nevertheless, the configuration unnecessarily relies on an untrusted transport and a nonstandard mirror, exposes dependency-request metadata, and permits denial of service or redirection attempts. Risk increases if the lockfile is modified, integrity checking is bypassed, or installation tooling does not enforce the integrity field. The manifest also declares `turndown` with the range `^7 ...[truncated 1928 chars]
- Remediation
- ## Remediation Suggestions 1. Regenerate `package-lock.json` using the official npm registry over HTTPS: ```bash npm config set registry https://registry.npmjs.org/ rm -rf node_modules package-lock.json npm install --package-lock-only ``` 2. Verify that every `resolved` URL in the regenerated lockfile uses HTTPS and points to an approved registry. 3. Pin the direct dependency exactly in `package.json`: ```json { "type": "module", "dependencies": { "turndown": "7.2.2" } } ``` 4. Use deterministic installation in documentation and deployment: ```bash npm ci --omit=dev --ignore-scripts ``` `--ignore-scripts` reduces lifecycle-script exposure where package functionality does not require installation scripts. 5. Add CI validation that rejects lockfiles containing `http://` dependency URLs or unapproved registries. 6. Retain and verify lockfile integrity hashes, review dependency updates, and periodically run an appropriate dependency vulnerability scanner.
