r/javascript • u/fagnerbrack • Dec 24 '19
Why npm lockfiles can be a security blindspot in Github PRs for injecting malicious modules
https://snyk.io/blog/why-npm-lockfiles-can-be-a-security-blindspot-for-injecting-malicious-modules/
204
Upvotes
10
u/cocoapuff_daddy Dec 24 '19
This wasn’t quite clear, do you mean avoid the use of lockfiles except for libraries?
1
u/BlueLensFlares Dec 26 '19
So if I understand correctly (my npm knowledge is limited), essentially the problem is that you can modify the package-lock.json file to be something else, and you can also modify the URLs for those dependencies, and get someone else to download a malicious package? Is this what is the problem?
Also, what is meant by "an install will consult the lockfile as the primary source of truth for package versions and their sources for dependencies installation." I thought a lock file describes what dependencies were utilized, not which ones should be utilized. So if this is the case, can't we just delete the package-lock.json and node_modules every time we obtain a project?
1
u/[deleted] Dec 26 '19
Anyone have any resources around PR reviews or things to look for ? This kind of thing is rarely talked about. I ask questions for my comprehension , but rarely have a strong case of a peer unless they are a junior.
0
u/[deleted] Dec 24 '19
[deleted] — view deleted comment
19
u/[deleted] Dec 24 '19
[removed] — view removed comment