Description
Range versions are problematic in context of financial applications. Suppose some package is specified in dependencies as ^1.0.0
. This means that on npm install
, when 1.0.1
is released, it would be auto-installed. If an adversary gains access to the package, and publishes malware in 1.0.2, ejs users would automatically get malware.
I've pinned versions manually in the past, but over the time new contributors would, by lack of knowledge, would add ranges back.
NPM can't be assumed to remove malware: for example, i've reported the account around 3 weeks ago and nothing is done.
There are 3 parts:
- Low-priority: ensure devDependencies are not using ranges
- High-priority: ensure dependencies are not using ranges
- Also important: ensure dependencies do not duplicate dependencies (1.0.0 and 1.1.0)
The tool which checks this (inside of all package.json
) could be simple and consume as few as 1-2 hours of work. It doesn't need any dependencies itself. The tool should auto-run inside of CI on every commit.