Security

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

13 SHARE

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

13 Comments

More from The Register

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

Countdown to ancient IE a telltale sign of malice

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

Ordinary folk may be confused by title, takedown demand suggests

'No, we are not rewriting Office in JavaScript' and other Microsoft tales

The week's good, bad and weird from Redmond

Next; tech; meltdown..? Mandatory; semicolons; in; JavaScript; mulled;

Punctuation-averse devs, you're coding it wrong

CSS and Javascript on GOV.UK page take early Christmas holiday

Updated El Reg asks why; they magically reappear. Fancy that!

When SecureRandom()... isn't: JavaScript fingered for poking cash-spilling holes in Bitcoin wallets

If you've got an old money store, check it for hacked gaps

When it comes to ML, reports of JavaScript's death are exaggerated

Python is not the be-all and end-all of writing smart algorithms

Wondering where your JavaScript libs went? Spam-detection snafu exiled npm packages

Postmortem sheds light on brief dependency hell

JavaScript spec gets strung out on padding

ECMAScript 2017 addresses left-pad gate, alongside various improvements

Web-app devs note: Google wants to banish JavaScript dialogues

Do you really want to leave this malware-serving page? No/No