question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lock-down dependencies with npm shrinkwrap

See original GitHub issue

The npm shrinkwrap feature allows locking-down the package dependencies even when installed as an npm package and not manually from source. It is generally recommended to enable this for top-level apps like daemons and CLI tools, but not for libraries intended to be used as part of a larger app.

Other than ensuring a consistent environment and preventing dependency issues, locking down to specific versions also has the security advantage of package updates having to be explicit. To give a recent example, automatic updates of packages down the dependency tree helped enable the Copay hack just a few months ago. With npm shrinkwrap, the malicious version of the event-stream dependency wouldn’t be installed unless the copay developers explicitly updated their deps inside the time window where event-stream was vulnerable – which is still possible, but much less likely.

To enable shrinkwrap, just run npm shrinkwrap, which will rename the package-lock.json file to npm-shrinkwrap.json, and check that in.

There’s some more information on shrinkwrap on the npm blog (from the web archive, appears to be unavailable on the website for some reason).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
janosidecommented, Feb 23, 2019

Ah very cool. Thanks for the info, as always 😃

https://www.npmjs.com/package/btc-rpc-explorer

0reactions
shesekcommented, Feb 23, 2019

Awesome! I’ll send a PR to update the installation instructions 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm-shrinkwrap - Lock down dependency versions
npm -shrinkwrap - Lock down dependency versions ... This command locks down the versions of a package´s dependencies so that you can control...
Read more >
npm-shrinkwrap
Lock down dependency versions for publication. ... command repurposes package-lock.json into a publishable npm-shrinkwrap.json or simply creates a new one.
Read more >
Managing Node.js Dependencies with Shrinkwrap
Run "npm shrinkwrap", add npm-shrinkwrap.json to git, and publish your package. To add or update a dependency in a shrinkwrapped package: Run " ......
Read more >
Lock Down Your Node Modules With NPM Shrinkwrap
The way NPM Shrinkwrap works is that it takes a snapshot of all your modules and sub modules dependency tree, and generates a...
Read more >
When to use shrinkwrap, npm-lockdown, or npm-seal
npm shrinkwrap is the most standard way how to lock your dependencies. And yes, npm install does not create it by default which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found