News for hackers. Stuff that matters.
Re:Time for developers to address the chaos of Node.js and NPM by gringoDan on Friday March 30, 2018 @12:32PM (#16717535)
An additional element adding to this chaos is the security vulnerability of npm packages. How often do we actually examine the package's code in detail before including it in a project?

Relevant article: https://hackernoon.com/im-harvesting-credit-card-numbers-and...

Re:Time for developers to address the chaos of Node.js and NPM by deusex_ on Friday March 30, 2018 @01:35PM (#16718110)
How is it different from maven deps?
Re:Time for developers to address the chaos of Node.js and NPM by kkapelon on Friday March 30, 2018 @01:58PM (#16718330)
Usually you don't use maven deps directly. You have a registry in your company that caches maven packages for you and runs vulnerability scans on the binary. So the binaries you end up using are "tested" internally.

Is that how people use NPM?

Also maven central does NOT support unpublishing of binaries. So if you have version 1.2 of something and you have scanned it once for vulnerabilities, it should always be the correct one. Nobody can publish again 1.2 in the central repo

Re:Time for developers to address the chaos of Node.js and NPM by kabes on Friday March 30, 2018 @02:08PM (#16718431)
In every somewhat serious company I've worked they used a local npm cache like jfrog (usually same one that's used for maven) that can get scanned for security. So yeah, that's how people use npm.

Unpublishing within those companies is usually not allowed, in the official npm registry you can only unpublish within the first 24 hours of publishing, after that you need to request it by email.

Re:Time for developers to address the chaos of Node.js and NPM by kkapelon on Friday March 30, 2018 @02:39PM (#16718697)
>In every somewhat serious company I've worked they used a local npm

If that was the case for everybody, then left-pad would not have caused a problem for anybody. People would not notice anything wrong with their builds. The amount of github comments where people say that their production build just broke because of a missing package implies that people are NOT using NPM with a local registry

>in the official npm registry you can only unpublish within the first 24 hours of publishing

I don't believe this to be the case https://news.ycombinator.com/item?id=16087024

Re:Time for developers to address the chaos of Node.js and NPM by twelve40 on Saturday March 31, 2018 @05:21AM (#16722516)
Just because it's a shitty common practice doesn't mean there isn't a proper way to do it (local repo). For example, there are tons of people who check in their secrets into public and private Github repos (including Uber eng), then they get jacked and complain. If they were smarter than that, "it would not have caused a problem for anybody". Doesn't really prove that what a lot of people do must be automatically good.
Re:Time for developers to address the chaos of Node.js and NPM by kkapelon on Saturday March 31, 2018 @06:29PM (#16725511)
True, but the fact that NPM seems to be the only repository where packages can be "re-published" further exacerbates the bad practices.

https://status.npmjs.org/incidents/41zfb8qpvrdj

The fact that 9 packages could be "published over" _after_ the left-pad fiasco, shows lack of attention.

Tools should try to foster good practices, instead of worsening bad ones.

Re:Time for developers to address the chaos of Node.js and NPM by calibas on Friday March 30, 2018 @01:17PM (#16717936)
I don't know if it's still the case, but one of the first things I learned about JavaScript was how it was inherently secure. Then I actually started using the language, and learned what utter bullshit that is.
Re:Time for developers to address the chaos of Node.js and NPM by gramstrong on Friday March 30, 2018 @01:47PM (#16718226)
> inherently secure

Who told you that? I don't think "inherently secure" is a thing in the tech industry.

Re:Time for developers to address the chaos of Node.js and NPM by calibas on Friday March 30, 2018 @02:52PM (#16718793)
I was taught that Javascript is safe because it has no input/output on its own, which is essentially true, but it's dangerous to work from that assumption since in the real world a program needs to have input/output to be useful.
Re:Time for developers to address the chaos of Node.js and NPM by marshray on Friday March 30, 2018 @04:15PM (#16719468)
Node.js adds that input/output.
Re:Time for developers to address the chaos of Node.js and NPM by TheAceOfHearts on Friday March 30, 2018 @01:52PM (#16718274)
The ECMAScript spec doesn't include details about its environment. You can run it in varying environments, each of which has different security criteria. For example, you can run a fully isolated JS VM that has no interactions with the real world, which is certainly quite safe. Node has full access to pretty much all the user's system resources, while the browser is a bit more sandboxed and restricted in what it can access.
Re:Time for developers to address the chaos of Node.js and NPM by calibas on Friday March 30, 2018 @02:46PM (#16718747)
Except in the case of Spectre/Meltdown...