Independent of the language, I only use external code if it is small enough that I can manually review it. Often I refactor it into a single file during this process. This of course excludes the majority of packages out there. But apart from security, it has another benefit: These dependency very rarely break and need updates. So compared to projects with a more complex stack, projects with a lean stack are easier to…
Ask HN: How do you security-audit external software using NPM packages?
21–30 of 85 posts
Re: Ask HN: How do you security-audit external software using NPM packages?
#22But the other complementary approach is to lock down other things - so for example, if you're running in a container, make sure that container can only talk to the proxy in front of it. That way, even if there was some kind of malicious code running in one of the modules, there's no way for any data to get in or out (unless it finds a way of injecting into any web input/output, but then you need to be scanning for that too)
Re: Ask HN: How do you security-audit external software using NPM packages?
#23A WordPress plugin may contain hundreds of interdependent npm packages all neatly bundled and minified. Without access to a package.json or package-lock.json it is quite hard to find out which individual packages have been used. Quite often there is also no public repo available of the development files. To give an example of my process thus far: Someone in my team wants to see if we can use plugin X. I’m downloading…
My first question here would be: What is the attack vector you are worried about? If your wordpress instance is taken over, what is the problem? That the intruder gains access to data they should not have? Or that they will use your machine in some way that would harm you?
Re: Ask HN: How do you security-audit external software using NPM packages?
#24Is there really anything better than `npm audit`, even with all its faults? Any relatively popular and well tested library will pull in dozens of dependencies. $ du -hs node_modules 289M node_modules Yeah no...
> Yeah no... That is only a valid stance to take while you're developing most of the "regular" software out there, but once you start dealing with finance data in an industry that's highly concerned with compliance and security you might get more demands forced upon you in regards to what you can or cannot do. That's not to say that there exists a better auditing mechanism, short of allotting a large amount of your t…
I'd think financial institutions would avoid such a scenario entirely? The work cant also easily be split up - just because two libraries are correct doesnt mean both of them together are correct.
Re: Ask HN: How do you security-audit external software using NPM packages?
#25You’re primarily talking about proactive auditing here, but if something does sneak in you’ve got problems. In the best spirit of layered security you should also build up a strong Content Security Policy and include that with your pages to make sure that there’s a whitelist of the servers the page can talk so, and that technologies you know you’re not using are locked down.
Re: Ask HN: How do you security-audit external software using NPM packages?
#26Independent of the language, I only use external code if it is small enough that I can manually review it. Often I refactor it into a single file during this process. This of course excludes the majority of packages out there. But apart from security, it has another benefit: These dependency very rarely break and need updates. So compared to projects with a more complex stack, projects with a lean stack are easier to…
There are certainly npm authors doing this already, feross[1] is a good example. That means you get packages like is-buffer[2].
[1]: https://www.npmjs.com/~feross [2]: https://github.com/feross/is-buffer/blob/master/index.js
Re: Ask HN: How do you security-audit external software using NPM packages?
#27Can you reverse lookup the packages using the abstract syntax tree? Most of it's probably from the top 10,000 packages.
I'd be curious to hear if anyone can think of possible applications of it in security auditing.
Re: Ask HN: How do you security-audit external software using NPM packages?
#28Earlier quoted context omitted.
> Yeah no... That is only a valid stance to take while you're developing most of the "regular" software out there, but once you start dealing with finance data in an industry that's highly concerned with compliance and security you might get more demands forced upon you in regards to what you can or cannot do. That's not to say that there exists a better auditing mechanism, short of allotting a large amount of your t…
> That is only a valid stance to take while you're developing most of the "regular" software out there, but once you start dealing with finance data in an industry that's highly concerned with compliance and security you might get more demands forced upon you in regards to what you can or cannot do. I'd think financial institutions would avoid such a scenario entirely? The work cant also easily be split up - just bec…
Then you'd only be relying on either the standard library, or packages that you (the company) have written yourself, which has a completely different set of challenges - everything from it being impossible to find people who know your internal libraries, to documentation and tests becoming a challenge etc.
Re: Ask HN: How do you security-audit external software using NPM packages?
#29Independent of the language, I only use external code if it is small enough that I can manually review it. Often I refactor it into a single file during this process. This of course excludes the majority of packages out there. But apart from security, it has another benefit: These dependency very rarely break and need updates. So compared to projects with a more complex stack, projects with a lean stack are easier to…
> It would be great if there was a "single small file packages" movement so that more lean open source software will be created. There are certainly npm authors doing this already, feross[1] is a good example. That means you get packages like is-buffer[2]. [1]: https://www.npmjs.com/~feross [2]: https://github.com/feross/is-buffer/blob/master/index.js
export function isBuffer (obj) {
return obj != null && obj.constructor != null &&
typeof obj.constructor.isBuffer === 'function' &&
obj.constructor.isBuffer(obj)
}
Imho, there is no need to pull 10 files into my project to use one function.Re: Ask HN: How do you security-audit external software using NPM packages?
#30Earlier quoted context omitted.
> It would be great if there was a "single small file packages" movement so that more lean open source software will be created. There are certainly npm authors doing this already, feross[1] is a good example. That means you get packages like is-buffer[2]. [1]: https://www.npmjs.com/~feross [2]: https://github.com/feross/is-buffer/blob/master/index.js
What I would do if I wanted to use "is-buffer" is I would copy this index.js to a new file called "isBuffer.js" and it would look like this: export function isBuffer (obj) { return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } Imho, there is no need to pull 10 files into my project to use one function.