|
|
|
|
|
by vemv
1744 days ago
|
|
Even a specific dependency can sneak malicious code. For example foo-2.3.1 when distributed over npm is not guaranteed to match its source over github. Here's a popular piece explaining various plausible scenarios https://medium.com/hackernoon/im-harvesting-credit-card-numb... (npm is not different from cocoapods I guess... except that npm dependency trees are famed for its size/depth) |
|
Certainly, Electron apps themselves should not be pulling dependencies at install time, those should be bundled into the app, that's the whole point of Electron. But they also don't need to pull their dependencies from the official NPM repos at build time either. You don't technically even need NPM installed on anything other than your dev machines, Node's dependency resolution during builds and at runtime doesn't rely on NPM at all.
I think some languages (Go springs to mind) are starting to slightly popularize dependency vendoring more, and at one point this was the official recommendation for Node apps/websites in the official docs. It fell out of fashion for some reason, but I think a lot of orgs would benefit from picking up the practice again.
It's also a good way to be a lot more deliberate about what you install, and a good way to make sure that new dependencies don't get snuck in without anyone noticing. It's very hard to hide a giant commit that introduces a thousand new files, and that can sometimes be a good opportunity to take a step back and ask yourself why you're adding a dependency that introduces thousands of files.