News for hackers. Stuff that matters.
Re:Malicious code in the purescript NPM installer by hobofan on Sunday July 28, 2019 @05:13PM (#20549869)
That's not a "solution". That's just shifting the trust to a different (smaller) group of people.
Re:Malicious code in the purescript NPM installer by jonas21 on Sunday July 28, 2019 @05:18PM (#20549891)
> That's just shifting the trust to a different (smaller) group of people.

Practically speaking, shifting trust from a large, anonymous group of people, to a small group of people who are known and trusted by the community is a pretty good solution.

Re:Malicious code in the purescript NPM installer by krainboltgreene on Sunday July 28, 2019 @05:42PM (#20549978)
Please list the group of people you trust to manage 1,037,274 packages.
Re:Malicious code in the purescript NPM installer by hedora on Sunday July 28, 2019 @06:27PM (#20550163)
I trust these people to manage software packages: https://nm.debian.org/public/people/dm_all

They “only” manage ~18K packages, but those 18K do a lot more than NPM:

https://people.debian.org/~corsac/

perhaps number of packages is the wrong metric.

Re:Malicious code in the purescript NPM installer by GordonS on Sunday July 28, 2019 @06:37PM (#20550206)
A lot of those packages are going to be versions months or sometimes years behind the latest version.

I'm not convinced this is a model that can work for programming libraries.

Re:Malicious code in the purescript NPM installer by justinclift on Monday July 29, 2019 @01:03AM (#20551646)
You may be correct for javascript, whose ecosystem is notoriously unstable and the equivalent of "building on sand".

eg write some code in a JS framework, then go off and do something for 18 months. Come back and there's a very good chance the entire framework has been obsoleted and replaced, perhaps even several times.

In JS land that's "Doh, well of course!".

In sane ecosystems (eg not Ruby), not so much. ;)

Re:Malicious code in the purescript NPM installer by halostatue on Monday July 29, 2019 @01:03PM (#20556780)
This is a problem for _any_ active development package, to the point where most language communities have (previously had) instructions on how to fix breakage of the language introduced by, for example, arbitrary Debian packaging restrictions without working with the language maintainers.

I seen this in _any_ environment that has a relatively active package management system of its own (e.g., Ruby, Perl, and Python included)—and it _still_ happens in some Java cases. The only _sane_ thing to do is to completely ignore the OS package management system and to package your applications as relocatable install packages complete with all dependencies you need, modulo the minimal OS stuff required.

Re:Malicious code in the purescript NPM installer by umanwizard on Sunday July 28, 2019 @09:47PM (#20550896)
It does work, in practice, and has for years. Every package in the Debian (or Ubuntu, or FreeBSD, etc.) package repos depends only on other packages in those repos and on the base OS. It works fine.

Packages being months behind the latest version is a feature, not a bug — it means things will only be randomly changing under your feet rarely, with the exception of security fixes.

Re:Malicious code in the purescript NPM installer by trabant00 on Monday July 29, 2019 @02:24AM (#20551943)
> Packages being months behind the latest version is a feature, not a bug

I struggle to convince devs and management about this in the past few years. Everyone's gone crazy about latest and greatest set of features with no respect for stability, maintainability, etc.

Re:Malicious code in the purescript NPM installer by tudelo on Monday July 29, 2019 @10:22AM (#20554877)
To be fair upgrading very old libraries because you hit a fixed bug to very new libraries can be a long process... but I never have worked on a project that stayed on new libraries continuously so... not sure how it works the other way.
Re:Malicious code in the purescript NPM installer by gregmac on Sunday July 28, 2019 @10:49PM (#20551166)
> Packages being months behind the latest version is a feature, not a bug — it means things will only be randomly changing under your feet rarely, with the exception of security fixes.

If things are "randomly changing" by updates, that means the upstream package isn't following semantic versioning practices, and more importantly, isn't preserving backwards compatibility with their releases. That's a mark of bad software development practices, and it also isn't solved by an arbitrary wait period: that just means months after the breaking change is done, you finally notice and complain, but most maintainers are going to (rightfully) ignore you by that point.

I'd make the same argument in general software quality: with new features, often come new bugs, so by delaying, you can delay introduction of those bugs. However, bugs are easier to fix the sooner they're found, so again, quick turn-around improves things, even if it sometimes causes short-term pain.

This is one thing where NPM is definitely miles ahead of APT. With APT, you get a single version of each package, so it's all or nothing. With NPM, you can specify `1.1.x` so even if a version 1.2 or 2.0 comes out, you're on the stable old one. The closest thing that seems to happen with linux packaging is on a major version (with backwards-incompatible changes) a new package name is created with a "2" on the end, to signal this incompatibility -- how is that anything but a hacky workaround to not having proper versioning support?

Re:Malicious code in the purescript NPM installer by voltagex_ on Monday July 29, 2019 @01:22AM (#20551713)
>With APT, you get a single version of each package, so it's all or nothing.

It's definitely not used as often as in npm packages, but you can use =version after your package name to apt install a particular version, or apt pinning for more complex setups.

Re:Malicious code in the purescript NPM installer by Xylakant on Monday July 29, 2019 @02:08AM (#20551875)
The point your parent is making is that with mom, you can install one version of a package per project you’re working on, instead of one version on the system. Especially if you’re working on multiple projects or multiple versions of the same project, this is required.
Re:Malicious code in the purescript NPM installer by soulofmischief on Sunday July 28, 2019 @10:00PM (#20550944)
But it doesn't work for libraries people will be using in development. Often you are waiting for a handful of packages to introduce specific features or bug fixes and need them the moment they are available. NPM isn't user space, it's dev space. Timeliness is the maxim.
Re:Malicious code in the purescript NPM installer by umanwizard on Sunday July 28, 2019 @10:06PM (#20550969)
I’m not a JS developer so maybe I’m missing something, but how do you use a library during development and not use it in production?

In the C++ world, I can’t imagine a situation where you would need to depend on, for example, libjpg while developing, but not need to read JPEG files in prod/end-user-space.

Re:Malicious code in the purescript NPM installer by huehehue on Monday July 29, 2019 @12:52AM (#20551607)
There are a slew of dev-only dependencies in JS-land. Packages that run local servers for hot-reloading during development. Test runners, linters, TypeScript compilers, SCSS compilers, and so on. None of those things need to be included with the bundled product.

Check out Electron or React starter apps for an example, their boilerplates should have dozens of examples.

Re:Malicious code in the purescript NPM installer by soulofmischief on Monday July 29, 2019 @01:01AM (#20551642)
Since another user explained that point, I would also add that in the "move fast and break things" environment of the web, for better or for worse, responsive and automated library updates are often desirable or even required functionality which can be tied to substantial real-world profits if something suddenly goes wrong somewhere in the stack.
Re:Malicious code in the purescript NPM installer by pjmlp on Monday July 29, 2019 @02:31AM (#20551973)
Web development is one of my tasks and thakfully we don't move fast and break things, rather rely on proven and established development stacks like JEE, Spring, ASP.NET and VanilaJS.
Re:Malicious code in the purescript NPM installer by soulofmischief on Monday July 29, 2019 @02:54AM (#20552078)
There are some reasonably stable packages in the npm ecosystem, it's just pretty much the Wild West out there. It really depends on what you're building. It's pretty hard to get a new SPA started these days without a development environment which uses npm, especially if you're running lean.

The problem is keeping your dependency tree reasonable. Even pulling in a couple of packages might lead to hundreds of dependencies. And even if you have the sense not to use an external package for something as simple as left-padding a string, someone somewhere in that dependency tree might not feel the same way. And that's all it takes to bring a chunk of the web down.

All of these problems of course are due to JS not having a mature ecosystem or standard library. People shouldn't need to reinvent the wheel every hour, nor should they be pulling in modules less than a dozen or two lines of code. That, and the constant misguided financial incentive to deploy ever more complex functionality over http are what lead to this aggressive push for cutting edge tools.

Re:Malicious code in the purescript NPM installer by naniwaduni on Sunday July 28, 2019 @10:29PM (#20551075)
In the C++ world, you almost certainly don't need headers in prod.
Re:Malicious code in the purescript NPM installer by umanwizard on Sunday July 28, 2019 @10:31PM (#20551084)
Yes, true. What’s your point? You still need libjpg to be either statically linked into your executable or present on the target system.
Re:Malicious code in the purescript NPM installer by liveoneggs on Monday July 29, 2019 @03:43PM (#20558582)
headers are not libraries
Re:Malicious code in the purescript NPM installer by toupeira on Sunday July 28, 2019 @07:54PM (#20550495)
Looking at [1] and [2], in unstable it actually seems to be:

- 31K source packages

- which build into 136K binary packages

- consisting of 1.2 billion lines of code

[1] https://sources.debian.org/stats/

[2] https://packages.debian.org/unstable/allpackages?format=txt....

Re:Malicious code in the purescript NPM installer by SCLeo on Sunday July 28, 2019 @08:17PM (#20550584)
Honestly, I think the reliability of those packages are not guarded by these people, but rather by the corresponding communities of those packages.

If one of the community failed to secure its package from malicious people, these people at debian are not going to be able to stop it.

Thus, those packages are still guarded by a huge community.

Re:Malicious code in the purescript NPM installer by umanwizard on Sunday July 28, 2019 @09:49PM (#20550903)
Why do you think this? OSes like Debian don’t just pull packages from upstream automatically. Packages have actual maintainers affiliated with the OS, not the upstream community, and it’s those maintainers who build packages for the OS repos.
Re:Malicious code in the purescript NPM installer by oefrha on Monday July 29, 2019 @10:44AM (#20555100)
My software is packaged by Debian, and the update process is me notifying the Debian Developer (DD) responsible for the package of the new version => said DD pulling the new tarball from GitHub. Pretty sure no one’s gonna notice until after it’s pushed to Debian FTP if I introduce some subtle malicious code. Point is DDs don’t review version deltas for the most part, so when the upstream is compromised, they add little to your defense (other than security by outdatedness, I suppose).
Re:Malicious code in the purescript NPM installer by umanwizard on Tuesday July 30, 2019 @09:46PM (#20571031)
Sure, but a very long time will pass between it being uploaded and being merged into stable, so there is a lot of time for people to discover your malicious code.

It is not like npm or crates.io where you can just upload whatever random code you like and people will start picking it up immediately.

But it’s not foolproof, sure, I agree with that.

Re:Malicious code in the purescript NPM installer by ryacko on Sunday July 28, 2019 @10:07PM (#20550974)
Not entirely true, Debian actually made OpenSSL less secure once: https://www.debian.org/security/2008/dsa-1571
Re:Malicious code in the purescript NPM installer by umanwizard on Sunday July 28, 2019 @10:09PM (#20550988)
This doesn’t contradict my point. I never said that Debian maintainers are more trustworthy than upstream 100% of the time.

I merely said that Debian packages are built, uploaded, and vended by Debian package maintainers, not by upstream. Whether that makes them more trustworthy or less is a different question.

Re:Malicious code in the purescript NPM installer by hnbroseph on Sunday July 28, 2019 @09:30PM (#20550843)
> I trust these people

why?

Re:Malicious code in the purescript NPM installer by varjag on Monday July 29, 2019 @02:43AM (#20552024)
There is a process for recruiting Debian devs where trustworthiness is a consideration.

https://wiki.debian.org/DebianDeveloper#Advocating_a_Debian_...

There is none for npm.

Re:Malicious code in the purescript NPM installer by scbrg on Monday July 29, 2019 @02:24AM (#20551942)
Can't speak for parent, but because they have historically shown themselves to be trustworthy.

I don't know much about the "NPM community," but judging from the bits I do hear, I'm not sure they have done the same. OTOH, I understand that as an outsider that only pay attention when shit blows up, I'm only seeing the bad parts.

[dead]
Re:Malicious code in the purescript NPM installer by justinclift on Monday July 29, 2019 @01:06AM (#20551657)
Those packages provide pretty much every software capability computing has to offer. It's a pretty vast set of capabilities, though npm/javascript itself has gotten way out of hand over the last few years too. ;)
Re:Malicious code in the purescript NPM installer by acheron on Monday July 29, 2019 @12:45PM (#20556561)
Indeed. I looked through the Debian packages and didn't see left-pad anywhere.
Re:Malicious code in the purescript NPM installer by hnbroseph on Sunday July 28, 2019 @09:29PM (#20550841)
why is it "so hilariously wrong"?
Re:Malicious code in the purescript NPM installer by JustSomeNobody on Sunday July 28, 2019 @07:18PM (#20550371)
What do you propose should be done?
Re:Malicious code in the purescript NPM installer by fock on Monday July 29, 2019 @03:56AM (#20552392)
Tell me, why one needs packages such as this except for personal (and ultimately npm) marketing: https://github.com/sindresorhus/shebang-regex - the whole thing smells
Re:Malicious code in the purescript NPM installer by inimino on Monday July 29, 2019 @06:09AM (#20553023)
You're being downvoted because that is mean-spirited, but the reason we needed these packages is to find out what the right size of package is. We now have a lower bound.
Re:Malicious code in the purescript NPM installer by fock on Monday July 29, 2019 @07:44AM (#20553474)
I'm not sure what's mean-spirited about the simple statement that the size/complexity of the npm-eco-system arises only from personal/corporate business-decisions.

But thanks for telling me anyways ;)

Re:Malicious code in the purescript NPM installer by inimino on Monday July 29, 2019 @02:48PM (#20557961)
Business decisions and marketing are not the only reasons people write open source software and you would do well to remember it.
Re:Malicious code in the purescript NPM installer by hanniabu on Monday July 29, 2019 @02:28AM (#20551957)
In my opinion there should be different namespaces, similar to what the parent mentioned. There can still be the public namespace as there is now, but there can also be ones registered, such as google/mysql-golang. The other alternative is that it's just linked to Github/Gitlab, but then you run into potential naming collision issues.