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 →
- Run
npm ci --ignore-scriptsor setignore-scripts=truein.npmrc. - Expect breakage in packages that compile native code or download binaries (
sharp,esbuild,node-gypmodules). - Explicitly rebuild trusted ones:
npm rebuild esbuild. - 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.
More on Supply Chain Security
What is an SBOM, and at which point in the pipeline do you generate it?BeginnerA customer asks for an SBOM for your product. What do you give them?BeginnerHow do you sign container images in GitHub Actions without managing private keys?IntermediateYou signed images in CI. How do you make sure the cluster only runs signed images?IntermediateLeadership wants "SLSA compliance". What do you propose?IntermediateWhat is typosquatting and how do you protect developers from it?Beginner