T08 · Insecure Dependencies
Warning
- Location
- package-lock.json:20
- Finding
- Dependencies Are Retrieved Through a Non-Official npm Registry Mirror<![CDATA[ ## Vulnerability Details **File Location**: `package-lock.json:20-30` **Vulnerability Type**: Dependency supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```json "node_modules/axios": { "version": "1.15.0", "resolved": "https://registry.npmmirror.com/axios/-/axios-1.15.0.tgz", "integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.11", "form-data": "^4.0.5", "proxy-from-env": "^2.1.0" } } ``` The same non-official registry is used for the other locked transitive dependencies, including the entry at `package-lock.json:14-19`: ```json "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" } ``` ### Technical Analysis The lockfile resolves Axios and its transitive dependency chain through `registry.npmmirror.com` instead of the official npm registry. The documentation instructs users to run `npm install`, causing npm to consume these locked download URLs. The SHA-512 integrity fields provide meaningful protection against artifacts being modified without a corresponding lockfile change. Nevertheless, using an additional registry operator expands the dependency trust boundary and introduces availability, provenance, and supply-chain risks. If a future project update changes both a mirror-hosted artifact and its recorded integrity value, or if users regenerate the lockfile against that mirror without independent provenance checks, malicious package code could enter the installation. No evidence was found that the currently locked packages are malicious, and no package lifecycle scripts are declared in the reviewed project. This finding therefore concerns unsafe dependency provenance rather ...[truncated 1380 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Configure npm to use the official registry: ```bash npm config set registry https://registry.npmjs.org/ ``` 2. Remove installed dependencies and regenerate the lockfile from the official registry: ```bash rm -rf node_modules package-lock.json npm install --package-lock-only npm ci ``` 3. Review the regenerated lockfile and verify that dependency `resolved` fields use `https://registry.npmjs.org/`. 4. Continue retaining cryptographic integrity hashes and commit the reviewed lockfile to version control. 5. Prefer exact dependency versions instead of a broad range such as `"axios": "^1.6.0"` to make dependency updates deliberate and reviewable. 6. In automated or security-sensitive deployments, use: ```bash npm ci --ignore-scripts ``` This prevents dependency lifecycle scripts from running when the project does not require them. 7. Add dependency provenance and vulnerability checks to CI, such as `npm audit`, lockfile-diff review, and an allowlist for approved package registries. ]]>
