Join our Newsletter — 33% off our NHI Course

Notifications
Clear all

NPM supply chain attacks: are your dependency controls enough?


(@nhi-mgmt-group)
Member Moderator
Joined: 1 year ago
Posts: 18004
Topic starter  

TL;DR: Recent NPM attacks exploit predictable gaps in version ranges, lockfile trust, cooldown timing, and package provenance, according to ArmorCode, and show how exact pinning, npm ci, release-age controls, and install-script review reduce exposure. The lesson is that dependency governance, not just scanning, now determines whether poisoned packages reach production.

NHIMG editorial — based on content published by ArmorCode: Defending Against NPM Supply Chain Attacks: A Practical Guide

By the numbers:

  • When AWS credentials are exposed publicly, attackers attempt access within an average of 17 minutes and as quickly as 9 minutes in some cases.

Questions worth separating out

Q: What breaks when dependency resolution is treated as a routine build setting?

A: Teams lose control over what code is actually installed.

Q: Why do supply chain attacks target package publishing and lockfiles so often?

A: Because those are the places where trust becomes automated.

Q: How do security teams know if dependency controls are actually working?

A: Look for whether build systems prevent unauthorised version drift, whether package provenance is checked before install, and whether secret-handling code is isolated from broad application reach.

Practitioner guidance

  • Enforce exact versions in production manifests Replace broad caret ranges with exact pins for production dependencies, and reserve wider ranges only for low-risk development packages.
  • Review lockfile diffs as security changes Require manual review for any package-lock.json, yarn.lock, or pnpm-lock.yaml change that introduces unexpected version movement or new dependency paths.
  • Set a minimum release age in build policy Use min-release-age or Dependabot cooldown settings so newly published packages cannot enter builds during the highest-risk attack window.

What's in the full article

ArmorCode's full blog covers the operational detail this post intentionally leaves for the source:

  • Exact package.json examples for when caret and tilde ranges are acceptable in production versus development
  • A practical CI checklist for enforcing npm ci, reviewing lockfile diffs, and flagging new install scripts
  • How to configure min-release-age and Dependabot cooldown settings for NPM workflows
  • Examples of blocking known malicious domains and integrating provenance verification into build pipelines

👉 Read ArmorCode's practical guide to defending against NPM supply chain attacks →

NPM supply chain attacks: are your dependency controls enough?

Explore further

View Full Forum →  |  NHI Foundation Course →



   
Quote
(@mr-nhi)
Member Moderator
Joined: 3 months ago
Posts: 17593
 

Dependency trust has become a security decision, not a build convenience. NPM attacks succeed when automation accepts version movement as normal and teams treat dependency updates as routine maintenance. That assumption breaks under active supply chain pressure, because the registry, the lockfile, and the install command all become part of the trust chain. Practitioners should treat dependency resolution as governed access, not passive tooling.

A question worth separating out:

Q: Who is accountable when a poisoned package reaches production through approved dependencies?

A: Accountability usually sits with both the platform team that owns package policy and the application owners who accepted the exception. Once a package is allowed to execute, it becomes a governed privilege decision. That means approvals, publisher identity checks, and revocation procedures need ownership just like any other elevated access path.

👉 Read our full editorial: NPM supply chain attacks expose the limits of version pinning



   
ReplyQuote
Share: