News for hackers. Stuff that matters.
Re:Devs unknowingly use “malicious” modules snuck into offic... by viraptor on Monday September 18, 2017 @01:45AM (#15273634)
You mean that every time you write a new project you write your own request parser, your own server, your own web framework, your own database access libraries, etc. from scratch?

Packages taken over include misspelling of urllib. What exactly do you propose as an alternative here?

I'm all for limiting bloat, but your rant here seems completely inappropriate for the issue bring described.

Re:Devs unknowingly use “malicious” modules snuck into offic... by xroche on Monday September 18, 2017 @02:05AM (#15273694)
> You mean that every time you write a new project you write your own request parser, your own server, your own web framework, your own database access libraries, etc. from scratch?

No, but downloading random code is just insane.

As a comparison, Debian has ~3000 packages, and every single package had an identified maintainer, with its own GPG key, validated in face-to-face meeting with an ID card by three people, an identified upstream, etc. Each maintainer is physically identified, and has passed a number of technical validation steps, explained his motivation etc.

There is also a dedicated security team that can be contacted 24/7.

The system is not perfect, but it provides a good level of security. And this is a project only made by volunteers.

Re:Devs unknowingly use “malicious” modules snuck into offic... by onion2k on Monday September 18, 2017 @03:13AM (#15273915)
Debian has ~3000 packages, and every single package had an identified maintainer...

As of yesterday npmjs had 516,132 packages, which was an increase of 373 since the day before. Debian's 3000 packages is a couple of weeks of npmjs activity. Even if you stripped out the unnecessary, abandoned, or duplicate packages you're still looking at a something significantly different to Debian.

For what it's worth I think a well-maintained, verified, and known secure subset of npmjs would be a great idea, but the logistics of providing that would be effectively impossible without some serious cash behind it.

Re:Devs unknowingly use “malicious” modules snuck into offic... by seanp2k2 on Monday September 18, 2017 @04:14AM (#15274159)
The culture around what should be in a package is vastly different. Node has left-pad. Debian has stuff like Apache. Sure, those are radical examples, but the barrier to entry for Debian is pretty high (as is the standard for quality) vs npm where anyone can put whatever out there.

How do things like left-pad even come to be widespread dependencies? Does the node development process involve a lot of "gee I wonder if someone made a package for (simple thing I need to do with a few lines of code)"?

Re:Devs unknowingly use “malicious” modules snuck into offic... by ubernostrum on Monday September 18, 2017 @06:19AM (#15274624)
JavaScript has things like left-pad because it doesn't have a standard library of modules for common tasks like other languages do, and because some of its built-in types don't have the same rich set of operations as other languages.
Re:Devs unknowingly use “malicious” modules snuck into offic... by Babooster on Monday September 18, 2017 @09:10AM (#15275499)
http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how...

is a nice article on the subject of left-pad. If you can't implement a left-pad in less than 5 minutes yourself, you don't know how to code.

Re:Devs unknowingly use “malicious” modules snuck into offic... by Ajedi32 on Monday September 18, 2017 @09:34AM (#15275750)
Just because you _can_ spend 5 minutes re-inventing the wheel in every project you write, doesn't mean you _should_.
Re:Devs unknowingly use “malicious” modules snuck into offic... by chii on Monday September 18, 2017 @06:35AM (#15274686)
But the large number of packages available, even for seemingly trivial features, are what makes NPM popular and successful. You jest at left-pad, but there's real value in simple libraries they might only be "a few lines of code" because an app is made up of a large amount of "simple features" strung together.

Not to mention the code reuse factor.

If npm took the route of debian's verification/certification, you might end up with no libs at all!

Re:Devs unknowingly use “malicious” modules snuck into offic... by dozzie on Monday September 18, 2017 @03:21PM (#15278704)
> You jest at left-pad, but there's real value in simple libraries they might only be "a few lines of code"

Nicely said, but you omit the elephant in the room: that the dependencies have their cost, which is quite high and is rarely matched, much less offset, by the value of these "simple libraries".

Re:Devs unknowingly use “malicious” modules snuck into offic... by mafro on Monday September 18, 2017 @03:39AM (#15274028)
FWIW I have always thought this would become a problem for nodejs. Encouraging one-liner packages [1][2] is a recipe for an enormous dependency tree, and a totally impossible-to-manage security situation.

Python projects I have recently worked on might max out at 50 packages. The last project I worked on with nodejs as front end had 3000+ packages just for the UI.

[1] https://github.com/sindresorhus/ama/issues/10#issuecomment-1... [2] https://github.com/kevva/is-positive

Re:Devs unknowingly use “malicious” modules snuck into offic... by coldtea on Monday September 18, 2017 @04:44AM (#15274289)
>As of yesterday npmjs had 516,132 packages, which was an increase of 373 since the day before. Debian's 3000 packages is a couple of weeks of npmjs activity.

Only in volume. In code quality and man hours they're an order of magnitude ahead of all of npm.

(Just consider something like Linux the kernel, GCC, Apache, OpenJDK, core utils, Python, Postgres, etc, compared to the trite that even the best npm packages are).

Re:Devs unknowingly use “malicious” modules snuck into offic... by gjjrfcbugxbhf on Monday September 18, 2017 @03:51AM (#15274070)
Debian packages on average have more functionality than npm packages. Such a subset as you describe would be one (or a few) Debian package(s).
Re:Devs unknowingly use “malicious” modules snuck into offic... by jlgaddis on Monday September 18, 2017 @05:10AM (#15274384)
> ... Debian has ~3000 packages ...

It's irrelevant to your point but Debian 9 included >51,000 packages [0].

[0]: https://www.debian.org/News/2017/20170617

Re:Devs unknowingly use “malicious” modules snuck into offic... by mrmondo on Monday September 18, 2017 @02:17AM (#15273740)
Debian security are very good at their job indeed, however so many of the packages are so old they’re not usable, furthermore Debian doesn’t enable SELinux by default and has a number of policies missing which significantly weakens the average deployment.
Re:Devs unknowingly use “malicious” modules snuck into offic... by cassowary on Monday September 18, 2017 @02:32AM (#15273794)
Those comments are all irrelevant to the OP's point. Debian software is "old" by intention; it is part of the spec that it shouldn't be a moving target.

As for Debian making some policy decisions that you disagree with, it's very different for Debian to make decisions than for NPM to make decisions. There's just no comparison.

Re:Devs unknowingly use “malicious” modules snuck into offic... by jacalata on Monday September 18, 2017 @03:23AM (#15273968)
I agree that Debian is so different to npm as to make any comparison irrelevant, but you should direct that at the comment which introduced the comparisons, not one that pointed out ways it doesn't work to compare them.
Re:Devs unknowingly use “malicious” modules snuck into offic... by mrmondo on Monday September 18, 2017 @03:37AM (#15274017)
Indeed, sorry if I didn’t make it clear - I was commenting on the previous person who talked about Debian - not the OP.
Re:Devs unknowingly use “malicious” modules snuck into offic... by coldtea on Monday September 18, 2017 @04:43AM (#15274279)
>You mean that every time you write a new project you write your own request parser, your own server, your own web framework, your own database access libraries, etc. from scratch?

No, they mean that we need a better method than trusting some random popular GitHub / PyPy / npm whatever storage and delivery mechanism.

Strong core language libraries ("batteries included"), that come with your distribution of the language/compiler and are well maintained, used by millions, and signed would be a good start to at least have 80% of dependencies being actually dependable.

Re:Devs unknowingly use “malicious” modules snuck into offic... by viraptor on Monday September 18, 2017 @07:17AM (#15274855)
> Strong core language libraries ("batteries included"), that come with your distribution

There's a running joke in python that stdlib is where modules go to die. Stdlib by definition needs to be more dependable and stable than other places. But that reduces the innovation. There's a reason urllib is terrible to use and we're on urllib3 now, yet the nicest solution (requests) is not included.

See http://www.leancrew.com/all-this/2012/04/where-modules-go-to... This applies to some extent to all languages / runtimes.

Re:Devs unknowingly use “malicious” modules snuck into offic... by falsedan on Monday September 18, 2017 @06:27AM (#15274657)
> Strong core language libraries ("batteries included"), that come with your distribution of the language/compiler and are well maintained, used by millions, and signed would be a good start to at least have 80% of dependencies being actually dependable.

The trick is avoiding another urllib: shipped as a stdlib, and passed over for libraries with better interfaces.

perl has the idea of core and dual-life modules: when a new version is released, it ships with some additional modules. Some of these modules live in the perl repository & are called 'core modules'. Upgrading them requires a new version of perl to be release. Some of these modules are forked & published to CPAN & are called 'dual-life' modules. Upgrading them requires installing them from CPAN, and new versions of perl can provide a well-tested newer version.

All the modules used to be core-only, and over the years any which weren't heavily tied to the internals of the perl interpreter (like opcode deparsers etc.) have moved to be dual-life instead. This avoids problems like interface issues in the standard library by allowing a new version to be immediately released (with some overhead for developers who need to upgrade it for deployments), be tested in the real world, updated, and then included in the next language release.

Re:Devs unknowingly use “malicious” modules snuck into offic... by chii on Monday September 18, 2017 @06:39AM (#15274706)
Java ecosystem has just as many libraries, and yet you don't see this problem. Why is that? Maven Central is just as available to add to (last i checked, all you need is a public GPG key registered to the MIT public gpg server).
Re:Devs unknowingly use “malicious” modules snuck into offic... by thehardsphere on Monday September 18, 2017 @07:52AM (#15275038)
It's not just as available to add to; you can only add to Central through one of three approved hosts unless your project has a special exception. And those hosts all involve an actual review of your artifact, its signature, and your POM.

I've never done it, but it at least sounds like there's a process where you need to convince 3 or more people that adding your package is a good idea and will not hurt security. That's very different from PyPI or npm.

Re:Devs unknowingly use “malicious” modules snuck into offic... by watwut on Monday September 18, 2017 @12:46PM (#15277412)
There is only one person and you are not convincing the person much about security nor have to go through any kind of difficult vetting. Just formal stuff about packege naming, properly filled pom.xml and such.

However, you have to sign everything with pgp including updates and that is verified. You also have to own the domain with same path as your packages - meaning name space is larger and name clashes less likely. They actually check this and won't release unless you host project. Which explains why java open source tend to use packages like com.github.my_account.my_project

Re:Devs unknowingly use “malicious” modules snuck into offic... by chii on Monday September 18, 2017 @10:25AM (#15276211)
you don't need to convince anyone other than the central hoster - provide an issue in the tracker with the information required (see the myriad of existing projects https://issues.sonatype.org/projects/OSSRH/issues/OSSRH-3462...).

It's not a free-for-all like npm, but may be npm can learn a thing or two.

Re:Devs unknowingly use “malicious” modules snuck into offic... by gjjrfcbugxbhf on Monday September 18, 2017 @04:04AM (#15274119)
> Packages taken over include misspelling of urllib. What exactly do you propose as an alternative here?

1. Similar way of identifying who is responsible for a package to Debian style repo - would allow those affected to identify a named person if malicious code added.

2. Fuzzy matching of package names (so taking the library name urllib also takes urilib, urlib, urllib2 and other names with a short document distance).

3. Built in mechanism to allow third party reviews within the repositories infrastructure.

Re:Devs unknowingly use “malicious” modules snuck into offic... by flukus on Monday September 18, 2017 @02:02AM (#15273682)
> You mean that every time you write a new project you write your own request parser, your own server, your own web framework, your own database access libraries, etc. from scratch?

They made it pretty clear that they get them from a distro repository. Most are much better about managing breaking changes and offering years of security patches (at least to core packages).

> Packages taken over include misspelling of urllib. What exactly do you propose as an alternative here?

Stricter guidelines and auditing should have caught this.

Re:Devs unknowingly use “malicious” modules snuck into offic... by zizek23 on Monday September 18, 2017 @02:02AM (#15273683)
You are fighting a strawman. Either use the system package manager which has already thought about and solved these issues or if you must use a 'home brew' package manager, design a secure one. And if you can't do that limit the circus to developer machines.
Re:Devs unknowingly use “malicious” modules snuck into offic... by viraptor on Monday September 18, 2017 @02:14AM (#15273724)
I've not seen a non-trivial project which doesn't require at least one package outside of the repo, or an updated version. And then you either have to run your own repo and packaging process. (Been there, done that, not fun) Or mix sources. (noooooooope) Or just switch to pypi completely.

Even if you can work with that, you need to sort out differences between your destination system, test system, and all of your developers machines (who most likely run Mac, not your server Linux flavour). Sure, there's still docker, vagrant, etc. But this means slapping more and more layers just to make the same packages from the same source available.

And unless you want a "works on my machine" environment, you can't just leave developers to do whatever and use a different system in production. A home brew, limited system will just result in shadow it, which will use pypi unless your solution is much better and easier to use (and allows fresh versions to be imported)

I've been doing this stuff for years in big projects. It's not easy.