Interview Prep/DevSecOps/Supply chain: signing, SBOM and dependencies

`npm install` in CI pulled `@acme/billing-utils` from the public npm registry instead of the internal one

AdvancedTroubleshootingSupply chain: signing, SBOM and dependencies
Answer

Likely causes → Dependency confusion: the scope is not mapped to the internal registry in .npmrc, or a proxy resolves public before private and someone published a higher version publicly.

Diagnose →

npm config get @acme:registry
jq '.packages["node_modules/@acme/billing-utils"].resolved' package-lock.json
npm view @acme/billing-utils --registry https://registry.npmjs.org

Fix → Treat the build as compromised: rotate CI secrets the install scripts could read, then pin the scope:

@acme:registry=https://artifactory.acme.internal/api/npm/npm-internal/

Regenerate the lockfile and verify every resolved URL.

Prevent → Register your scope on npmjs.com, route all installs through a proxy that never resolves internal names publicly, and fail CI if resolved URLs point outside approved registries (lockfile-lint --allowed-hosts).

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply chain: signing, SBOM and dependencies