So here, you'll see that one of its dependencies contains install scripts. It also runs shell scripts and accesses the file system and accesses the network. So this is probably not something that you would expect a web component to be doing. And so it may be worth a little bit of further investigation to figure out what's going on here before you use this package.
The other thing that we do that's quite cool is we can highlight when packages do these things, and put that directly in line in the code. So in this package here, I opened it up to take a look at the files. And I could see here that the module is accessing the network, as well as accessing environment variables. And I can see the exact lines where the package is doing each of these things. And so it makes it a little bit easier to get an idea of what a package is doing before you run it.
So if you want to research packages on Socket before you use them, this is the URL you can use. And I highly recommend you take a look at some packages there, and use that information to make an informed decision before you select a package.
Okay, the other thing you can do is think about updating your dependencies at the right cadence. So what do I mean by this? So there's a question about, like, how quickly you should update your dependencies. And this is actually a question we struggled with on our team as well. So if you, you know, you can think of it as should we update slowly, or should we update really, really quickly and aggressively? If you update too slowly, you're exposed to known vulnerabilities. And you're running code that's old and that you know, may have issues, may have some bugs that have been fixed in the newer version. And so there's some downsides to updating too slowly.
On the other hand, if you update too quickly, you expose yourself to supply chain attacks, because you're now running code that may have been published, you know, literally yesterday or, or in the last couple of days, which means that you haven't had that many eyeballs able to look at the code. And so, you know, if as you think about security, you have to balance, you know, this, this tradeoff, and there really is no perfect solution here. It's just a hard problem.
Another idea is to audit every dependency. So, you know, if you're building a truly security critical application, like we were doing with wormhole, then you, you know, one option is to literally read every line of code of your dependencies. So if we, again, put this on, on an axis of starting from full audit on the one hand, reading every line of code to YOLOing on the other hand, and, you know, by YOLOing, I mean, like doing nothing? How closely should you audit your dependencies? And what you see here is we're in the same situation. We have tradeoffs and really no good, no good solutions. So doing a full audit is something that only the biggest and richest companies seem to do in practice. It's a lot of work. Usually you need to have a security team looking at every one of these packages, and we also have to approve them one at a time and add them to an allow list, which is really slow. And this is expensive just because of the time and the effort that it takes. On the other hand, doing nothing and just installing whatever you want without, even looking at the code, has its downsides. So it means that you're vulnerable to supply chain attacks.
Comments