This article is more than 1 year old

One-in-two JavaScript project audits by NPM tools sniff out at least one vulnerability...

...and those devs are then applying patches, we hope

JavaScript library custodian NPM, after years of security scrambling, looks to be getting a grip on its code safety.

There was that incident in May when NPM swiftly removed a backdoored package following complaints. No real damage was done.

A month earlier, the bit-shifting biz added a "audit" command to v6 of npm, the company's eponymous command line tool. Thereafter, npm-wielding developers had the option to type npm audit from the command line while in a Node.js project directory, generating a listing of known vulnerabilities affecting package dependencies hailing from code stored in the NPM registry.

Better still, simply typing npm install – the command to populate a Node.js project with packages declared in the package.json file – would run an automatic security audit.

Remediation is not automatic, but as of May, users gained the ability to type npm audit fix to replace outdated, insecure modules in projects with current, hopefully secure ones.

Since April, according to the company, npm users have run 50 million automatic scans and have deliberately invoked the command 3.1 million times. And they're running 3.4 million security audits a week.

Across all audits, 51 per cent found at least one vulnerability and 11 per cent identified a critical vulnerability.

Pull the other one

In a phone interview with The Register, Adam Baldwin, head of security at NPM, said he didn't have data on how many people are choosing to fix flagged flaws. "But what we've seen from pull requests suggests it's gaining traction," he said.

Incidentally, npm's thinking about security is finding similar expression elsewhere in the industry. Earlier this year, GitHub began alerting developers when their code contains insecure libraries.

During a recent media briefing, GitHub's head of platform Sam Lambert said he hoped that the process could be made more automated through the mechanized submission of git pull requests that developers could simply accept to replace flawed code.

Baldwin said NPM might implement something similar, an intervention rather than a simple notification. "Currently it's not proactive policy enforcement," he said. "But it's something we're considering."

That would appeal to NPM's growing enterprise constituency. "Enterprises for sure want the compliance and control," said Baldwin. "They want that ability to know the open source they're bringing in is safe or meets a certain set of criteria."

Upping its security game further still, NPM on Wednesday added “Report a Vulnerability” buttons to every NPM package webpage. The biz also started checking the hashes of passwords during account creation against the "Have I Been Pwned?" database, to help users avoid compromised passwords.

This isn't to say there won't be further security issues with NPM packages, but the tools for avoiding problems and fixing them are getting better. ®

More about


Send us news

Other stories you might like