Skip to content

Instantly share code, notes, and snippets.

@lirantal
Created December 23, 2019 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lirantal/900f121739f004c8c463d56bd0de125f to your computer and use it in GitHub Desktop.
Save lirantal/900f121739f004c8c463d56bd0de125f to your computer and use it in GitHub Desktop.
lockfile-lint concerns with package.lock

How to reproduce

  1. Use only the package.json manifest
  2. Run npm install
  3. Check /tmp/world.txt (should be empty)
  4. Update the package-lock.json file with the one provided in this gist
  5. Run rm -rf node_modules/ && npm install (notice how it's necessary in this vector to remove the node_modules/ folder)
  6. Confirm /tmp/world.txt is now created on the filesystem

References

  1. https://snyk.io/blog/why-npm-lockfiles-can-be-a-security-blindspot-for-injecting-malicious-modules/
  2. https://github.com/lirantal/lockfile-lint
{
"name": "lla",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ms": {
"version": "2.1.1",
"resolved": "https://github.com/lirantal/ms/tarball/master",
"integrity": "sha512-DlpjtaUS9RFy3q9oagI6RWUkIIk8UOJ+ZwxqlZ+y3sKvk3n93nD9gL/Nw06xI5i8YTqT9Q5znTs6HzVZO9BjDQ=="
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
}
}
}
{
"name": "lla",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ms": "^2.1.1",
"signal-exit": "^3.0.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment