Interview Prep/CI/CD/Supply Chain and Pipeline Security

How do you prevent dependency confusion and typosquatting in build pipelines?

AdvancedProductionSupply Chain and Pipeline Security
Answer

Resolve all dependencies through a repository manager that you control, with routing rules so internal package names and scopes only come from private repositories, and public proxies block names that collide with internal ones. Use scoped packages, lockfiles with integrity hashes, npm ci/pip --require-hashes, a cooling-off delay for new versions (Renovate minimumReleaseAge), and block install scripts where practical (npm ci --ignore-scripts then run required scripts explicitly). Monitor with tools like Socket or OSV scanning.

All CI/CD questions

More on Supply Chain and Pipeline Security