Interview Prep/DevSecOps/Supply Chain Security

What does `--ignore-scripts` change, and what breaks when you use it?

BeginnerScenarioSupply Chain Security
Answer

Situation read → npm runs preinstall, install and postinstall scripts of dependencies by default. They are a popular malware trigger.

What I'd do →

  1. Run npm ci --ignore-scripts or set ignore-scripts=true in .npmrc.
  2. Expect breakage in packages that compile native code or download binaries (sharp, esbuild, node-gyp modules).
  3. Explicitly rebuild trusted ones: npm rebuild esbuild.
  4. Document the allowlist in the repo.

Why → You choose which code runs at install time, instead of every package.

Interview tip → pnpm 10 disables dependency scripts by default and uses an allowlist.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply Chain Security