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

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

By Thomas Claburn in San Francisco


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. ®

Sign up to our NewsletterGet IT in your inbox daily


More from The Register

Facebook devs devise Hermes to push cross-platform JavaScript to godlike speeds

Not named after the French couturier but the Greek god of trade, roads, and thieves

JavaScript tells all, which turns out not to be so great for privacy: Side-channel leaks can be exploited to follow you around the interweb

And using browser privacy extensions may just make matters worse

JavaScript tracking punks given a thrashing by good old-fashioned server log analytics

Netlify dodges the blockers by going to the source

You like JavaScript! You really like it! Scripting lingo tops dev survey of programming languages

Meanwhile, one in five polled coders complain they were denied US work visas

Hackers seed StatCounter with nasty JavaScript in elaborate Bitcoin cyber-heist caper

Updated exchange believed to be target of embedded attack

settlement.js not found: JavaScript package biz NPM scraps talks, fights union-busting claims

Special report CEO speaks to The Reg as we dig into labor complaints, future of npm CLI

Brit prisoners to be kept on the straight and narrow with JavaScript and CSS

That's the sound of the men, working on the blockchain gang

Oracle demands dev tear down iOS app that has 'JavaScript' in its name

Ordinary folk may be confused by title, takedown demand suggests

How evil JavaScript helps attackers tag possible victims – and gives away their intent

Countdown to ancient IE a telltale sign of malice

StatCounter fingers cache-poisoning caper for Bitcoin-slurping JavaScript hijack

The good news? Nobody appears to have lost any Bitcoin, says