Interview Prep/DevSecOps/Supply Chain Security

A new npm worm is stealing tokens through install scripts. What do you change in your pipelines right now?

AdvancedScenarioSupply Chain Security
Answer

Situation read → Install-time scripts execute with the CI job's privileges and secrets. Reduce what they can reach.

What I'd do →

  1. Disable lifecycle scripts by default: npm ci --ignore-scripts (allow explicit exceptions for packages needing builds).
  2. Use short-lived tokens; replace long-lived npm publish tokens with trusted publishing (OIDC).
  3. Run installs in jobs with no cloud or publish credentials; separate install/build from publish.
  4. Check lockfile versions against the advisory; pin and add a release-age cooldown.
  5. Search for the published IoCs in repos and runner logs, then rotate any exposed token.

Why → If scripts cannot reach secrets, a malicious package has little to steal.

Interview tip → Separate "build with untrusted deps" from "publish with trusted credentials".

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply Chain Security