T08 · Insecure Dependencies
- Location
EXAMPLES.md:140- Finding
Unversioned Third-Party Package Installation Creates Supply-Chain Risk
- Content
View full analysis
- Remediation
View remediation
pg@ jsonwebtoken@ ``` 2. Generate and commit `package-lock.json` only after reviewing the resolved dependency tree and package integrity metadata. 3. For repeatable installation, use the committed lock file: ```bash npm ci ``` 4. In CI, use a clean, isolated runner with least-privilege credentials and restrict unnecessary network and filesystem access. 5. Audit direct and transitive dependencies using appropriate vulnerability and provenance checks before adoption. 6. Review packages for lifecycle scripts. Where operationally compatible, consider disabling scripts during initial inspection: ```bash npm ci --ignore-scripts ``` Required lifecycle scripts should then be reviewed and run explicitly. 7. Execute only locally installed command-line tools. Replace unrestricted `npx` usage with a local package script or: ```bash npx --no-install tsc --init --strict npx --no-install husky init ``` 8. Configure an approved registry, retain npm integrity verification, and consider package allowlisting or lock-file integrity enforcement in CI. ]]>
