Using npm install in production can lead to inconsistent installations when lockfiles and package.json files are out of sync, potentially introducing unintended package versions and security vulnerabilities that are resolved during install-time. These configurations prevent package managers from installing any package version that was published less than the specified time period ago. Configure npm, pnpm, Bun, or Yarn to delay package installations by setting a minimum release age in your package manager’s configuration file. The fetched repository can ship its own .npmrc that re-enables lifecycle scripts — silently undoing –ignore-scripts — and the code is never scanned by registry-side malware checks. Pnpm allows an “escape hatch” to re-enable postinstall scripts or set an explicit allow-list of packages that are allowed to run postinstall scripts.
The fake login page captured credentials and 2FA tokens through adversary-in-the-middle techniques. 80% of application dependencies remain un-upgraded for over a year, even when 95% of vulnerable components have fixed versions available (Sonatype, 2024). Several critical vulnerabilities in 2024 took over 500 days to fix (Sonatype, 2024). Packages that have not been updated in over 1,000 days are effectively unmaintained. The vulnerability might be https://www.inrecognition.org/what-are-the-trends-in-workplace-learning-and-development/ three or four levels deep in your dependency tree, invisible unless you specifically analyse the complete SBOM.
Shadowserver reports https://power-at-work.com/the-future-of-earthmoving-machinery-trends-and-predictions/ 90,300 instances still vulnerable. Npm audit checks against a single vulnerability database and only catches known, reported CVEs. This guide covers npm security comprehensively. Snyk’s research found 52% of teams often fail to meet vulnerability SLA deadlines, with 74% setting unrealistic SLAs of a week or less (Snyk, 2024).
Updated for AI 🤖 Continuous updates on how to stay safe from NPM supply chain attacks Here’s their talk on AI powered malware hunting at scale, Jan 2025. Socket.dev is a security platform that protects code from both vulnerable and malicious dependencies. SCA (Software Composition Analysis) tools scans the actual filesystem and finds standalone JS files, vendor scripts, and client-side assets regardless of whether they exist in a package manifest.
By implementing a “cooldown” period before installing or upgrading to new package versions, you reduce the risk of installing compromised packages that may be quickly discovered and removed from the registry. Newly released packages and versions may contain malicious code that are often-times quickly picked up by the community in matter of hours or days and subsequently unpublished. However, pnpm 10.26+ provides blockExoticSubdeps to prevent transitive dependencies from pulling code from git repositories or raw tarball URLs — sources that bypass registry security scanning. Pnpm does not have a direct equivalent to npm’s allow-git setting that blocks all git dependencies outright. Even with post-install scripts disabled, git-sourced dependencies can introduce unreviewed, unversioned code into your project.
The difference is that deps.dev offers a broader package intelligence report, such as metadata, licenses, and health signals etc. Here, I am following the best practice suggested by the node.js security best practices17. Pnpm also allows Git Branch Lockfiles where it creates a new lockfile based on branch name, and automatically merge it back into the main lockfile later. Modern package managers have built-in conflict resolutions1516, just checkout main and re-run install.