12 ms·
Another reminder of how annoying it is for a package system to have unqualified package names. Having to ask someone to gift a `purescript` package shouldn't e
by hombre_fatal 7y ago
Another reminder of how annoying it is for a package system to have unqualified package names.
Having to ask someone to gift a `purescript` package shouldn't even be a thing. It should've been `@shinn/purescript` and the compiler developers just create their own `@whatever/purescript`.
This is something Elm and many others got right. https://package.elm-lang.org/ https://package.elm-lang.org/ It's just infinitely, obviously better.
You see all sorts of problems because of this, like people "giving packages away" when they quit. Or buying package names. Or coming up with annoying name hacks because the obvious, best name is simply taken. Or people thinking/guessing that `npm install mysql` is the correct/best/canonical package because it's the simplest name, and anyone who publishes a better library has to name it mysql2 or better-mysql, etc. These just shouldn't even be things.
- McGlockenshire 7y agoEven PHP gets this right. It's not hard. It makes me wonder why npm hasn't already moved to namespaced package names.
- Fellshard 7y agoMostly because the vast majority of JS developers don't seem to be aware of the rest of the software universe, and so seem to reinvent the wheel, rediscover the worst of software's history, and discard the most useful of software findings with shocking regularity. NPM tends to reinforce the worst of the JS world's tendencies.
- geofft 7y agoPerl (cpan), Python (pip or conda), Ruby (gem), and Rust (cargo) all behave as NPM does, so that doesn't seem to be the explanation here.
- twic 7y agocargo, at least, does this for the reason Fellshard gives - the Rust team essentially commissioned a copy of Ruby's bundler, without considering whether there was anything to learn from any other language's ecosystem.
- geofft 7y agoWell, okay, if your point of view is that behaving like multiple other major languages and specifically taking the lessons (good and bad) of a specific existing language ecosystem into account before doing your own thing is the same as disregarding other languages and reinventing the wheel, I'm not sure what words mean anymore.
- twic 7y ago> Well, okay, if your point of view is that behaving like multiple other major languages and specifically taking the lessons (good and bad) of a specific existing language ecosystem into account before doing your own thing is the same as disregarding other languages If you've only looked at two or three languages that not coincidentally happen to do things pretty much the same as each other, and not looked elsewhere, then you are indeed disregarding other languages. > and reinventing the wheel I didn't mention reinventing the wheel. > I'm not sure what words mean anymore. Agreed, but i'm not sure i can help you with that.
- kibwen 7y agoNamespaces would be a feature of Crates.io, not Cargo (and Crates.io was not contracted to Yehuda Katz, as Cargo was).
- twic 7y agoHow so? Do you mean that Cargo would support crates with names like "example/foo" or "org.example/foo", but that's just not how Crates.io works? If so, that's interesting, but then my question is why we didn't make use of that.
- 7y ago
- Fellshard 7y agoThat is why I cited the behaviour and culture of JavaScript-only devs as the primary explanation, with NPM's model reinforcing those issues - issues that do not exist in the same manner in those other languages' ecosystems and cultures.
- wdroz 7y agoconda use namespaces (called channels). If you want a package from a random person, you've to explicitly add it (either globally or when installing the package).
- adev_ 7y ago> Perl (cpan), Python (pip or conda), Ruby (gem), and Rust (cargo) all behave as NPM does Wrong. None of them have chosen the "micro-package" way of NPM. None of them have an average size of "3-10" line of code per package, which NPM has for many MANY packages. Cargo, pip have many packages but "reasonnable size" packages. ( > 100 lines ). The Micro-package philosophy that NPM chose, meaning every single line of code can have its own package, increase by several factor the number of dependencies required to create anything in JS. A simple hello world in react already have ~100 dependencies https://npm.anvaka.com/#/view/2d/react-create-app https://npm.anvaka.com/#/view/2d/react-create-app Some core utility bundler/packer/etc overpasses 2000 dependencies https://npm.anvaka.com/#/view/2d/webpack https://npm.anvaka.com/#/view/2d/webpack This is madness. It is a simple evidence that bigger the dependency tree is, higher the chance of "one element" malicious / corrupted is. Maybe the NPM developpers / users should reflect on what lead to this situation instead of closing their eyes and sing "everything is fine".
- m90 7y ago> None of them have chosen the "micro-package" way of NPM. This is not something inherent to npm itself, it's what the people using npm choose to publish. No matter if people like small modules or not, it's not at all related to the topic discussed.
- adev_ 7y ago> No matter if people like small modules or not, it's not at all related to the topic discussed. It is very relevant to the topic discussed. Just for fun : https://npm.anvaka.com/#/view/2d/purescript https://npm.anvaka.com/#/view/2d/purescript > 150 dependencies. Including a package named "one-time", bundled several times in two different versions. To do something highly relevant and technical like "Call a function once". I have no doubt that it is an Highly complex code that requires indeed two packages..... Irony Little question: What would have been the probability of purescript getting malicious if its dependency tree would be something reasonnable... Let's say 20 packages instead of the current ~200 ?
- 7y ago
- allover 7y ago> Mostly because the vast majority of JS developers don't seem to be aware of the rest of the software universe Do you have any evidence to back up this statement, compared to developers in other languages? Or is this just business-as-usual JS bashing?
- Fellshard 7y agoPrimarily, I end up basing this off of the types of libraries being developed for Javascript, and what kinds of articles and thought leaders JS developers tout as innovative.
- buzzerbetrayed 7y agoSo by looking at a tiny fraction of the 1 million+ npm libraries, and articles by a few dozen people on the internet, you are able to conclude that the > vast majority of JS developers don't seem to be aware of the rest of the software universe Forgive me if I dismiss this as business-as-usual JS bashing
- pjmlp 7y agoFor starters, developers in other language communities don't publish packages for single line functions.
- Ayesh 7y agoPHP dependency management (composer and packagist) got many things right, such as namespaces packages, lock files, proper autoloading, etc.
- preommr 7y agoThey have, its just optional.
- allover 7y ago> Even PHP gets this right. It's not hard. PHP had the luxury of coming out with a package manager (Composer) later, and learning from others before it. (2012 vs 2010 for npm). Npm similarly improved on a lot of package managers that came before (e.g it's superior to Pip, which doesn't resolve dependencies [1]). > It makes me wonder why npm hasn't already moved to namespaced package names. Also, npm does have namespaced package names, the problem is that it was introduced later, so isn't mandatory. I'm not sure how they could make it mandatory without breaking everyone? [1] https://github.com/pypa/pip/issues/988 https://github.com/pypa/pip/issues/988
- oblio 7y agoApache Maven was released in 2004... PHP just looked at what Java was doing. Might be a wrong idea for some things but it definitely helps for stuff such as package management.
- deleted 7y ago[deleted]
- dane-pgp 7y agoFortunately it seems to be something that Entropic gets right: https://github.com/entropic-dev/entropic https://github.com/entropic-dev/entropic If it ends up supporting PGP signatures for packages (ideally created by developers using air-gapped machines) then so much the better: https://github.com/entropic-dev/entropic/issues/86#issuecomment-499605050 https://github.com/entropic-dev/entropic/issues/86#issuecomm...
- neilv 7y agoJava got that part right in the 1990s, when it was the cool Web-savvy language. At the time, I especially liked how they piggybacked onto the existing DNS domain name control, avoiding having to create a new centralized registry to keep names unique. (Of course, more could be done beyond that, today.)
- pvg 7y agothey piggybacked onto the existing DNS domain name control It's a recommended and widely-followed voluntary naming scheme - it's not in any way connected to domain name control.
- vbezhenar 7y agoBut it's easy to connect to domain name control. Allow uploading to maven central only after domain verification. Java did not do that, AFAIK, but other languages can do that.
- neilv 7y agoI should've been more clear about what I was saying with "control". The recommendation is connected directly to domain names you control. What was not done at the time was enforcing that, or using that as a basis of authentication or distribution, which is part of why I said more could be done, today.
- pvg 7y agoThe purpose of the scheme was to make namespace collisions less likely and that's about it, though. And people regularly deviate from it, both then and now. Not using it as a basis for authentication or distribution probably remains a really excellent idea.
- trabant00 7y agoImo your solution is just a band aid. The real solution is having a distribution of packages which are maintained and suppervised by a group of people. Like the linux distribution maintainers or the group that develops the language. Community contribuited packages should be declared "install at own risk" like in archlinux aur. All this is already solved. But people want to reinvent the wheel and ride the user generated content train.
- hobofan 7y agoThat's not a "solution". That's just shifting the trust to a different (smaller) group of people.
- jonas21 7y ago> 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.
- krainboltgreene 7y agoPlease list the group of people you trust to manage 1,037,274 packages.
- layoutIfNeeded 7y ago(Of which 1,000,000 are slight variations of leftpad.)
- hedora 7y agoI trust these people to manage software packages: https://nm.debian.org/public/people/dm_all 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/ https://people.debian.org/~corsac/ perhaps number of packages is the wrong metric.
- lonelappde 7y agoThere's nothing preventing whatever_purescript. Even if you have namespacing, anyone who owns a spot in it can sell or rent their spot to a malicious actor.
- timothycrosley 7y agoI don't actually feel like this solves anything, but instead just adds one more avenue for name hijacking. Now instead of trying to register an angular package first, I'll try to register a google namespace, or similar. If google is taken, I'll make an official_google, or g00gle etc.
- geofft 7y agoHow would that have helped things in this case? If we go with the hypothesis of an angry maintainer getting revenge, would they not be just as angry at their project being forked by the community, and just as able to sabotage it via other libraries still in their namespace? (And perhaps more willing, since their original name is still around.) If we go with the hypothesis of a compromised account, people will still be installing the package from the original maintainer's namespace, so they'll still get the malicious code. And in all likelihood, because the story here is that the maintainer intentionally (though begrudgingly) transferred ownership, they would have intentionally (though begrudgingly) given other people access to the package in their namespace, simply because people value the namespaced name. (If they didn't, and everyone was immediately happy to install anyone/purescript, then namespacing doesn't solve any problems and also creates some!) And the situation would have played out as given.
- delinka 7y agoWhy would anyone who owns a namespace be willing to leave a package that's moving to another maintainer within their own namespace? A namespace tends to come with a reputation, and if you give an outsider access to the namespace, the reputation can change without the owner's consent. No, I don't think I'd be allowing @delinka/ExcellentPackage to be maintained by someone else. They can fork it to @fredralphbob/ExcellentPackage and I'll turn off @delinka/ExcellentPackage when I'm done maintaining it. Yep, it'll break dependent installs, but that's the point: get dependents to move to the proper version. I think of a namespace like a domain. If I host a project at project.delinka.engineer, I'm definitely not transferring access to the subdomain to a new maintainer. Yep, we still have people who would eschew best practice and go against my method above, but that happens everywhere. Just because a solution isn't perfect doesn't mean it's not an improvement.
- yawaramin 7y ago> Yep, it'll break dependent installs, but that's the point: get dependents to move to the proper version. Probably more realistically, you'd put a note in your @delinka/ExcellentPackage repo readme saying that the package is deprecated and to use @fredralphbob/ExcellentPackage instead going forward, and simply not publish any more new versions. In fact I'm pretty sure npm has a built-in system to warn users of a package that its canonical name has changed.
- naniwaduni 7y agoThis is not a package namespacing issue. This is not a technical issue. It is mechanically no more difficult to change from "@shinn/purescript" to "@whatever/purescript" than it is to change from "purescript" to "purescript-whatever", except that in the common cases (where no disputed community moves have occurred without a corresponding name change) everyone has to include an author. The author can still "give away" or sell package names; a lot the value is not in holding the name, but having the existing installed base and mindshare. These are the social issues associated with a hostile fork.
- nullwasamistake 7y agoJava got this right with reverse domain names over a decade ago. To use a namespace you have to own the URL. Simple and effective abuse resistant package naming.
- munificent 7y ago> It's just infinitely, obviously better. Whenever a large number of skilled people do something for which an alternative is "infinitely, obviously better", there's a good chance that there is more going on than you know. RubyGems used to be namespaced this way and moved away from it. They didn't do so lightly. The problem is that ownership, and even names of owners change all the time. In the very very large majority of cases, this change of ownership is an implementation detail that doesn't need to impact package consumers. If you enshrine the owner's name in the package, it means any change of ownership is effectively a breaking change to the package. When you have very large transitive dependency graphs, the result is constant, pointless churn.
- mschuster91 7y agoWhy not resolve the owner name to some kind of uuid at time of package require/install and saving it in the lockfile? That way, a package upgrade can detect if the owner name has changed and fetch the correct package.
- gridlockd 7y agoThis doesn't solve the issue where you type "npm i -s letf-pad" and your computer gets taken over by The Russians™. Make people copy-paste the name, it decreases the chances of catastrophic failure.
- hardwaresofton 7y agoIt seems like a reasonable fix to this is to prevent name-specific owning (changing it to a group instead) -- this has the benefit that package maintainers who plan to maintain their packages forever can keep the same names, and those that don't can essentially fork their project and stop fixing the older version (@ <maintainer>/<project>) and force all changes to go to a new one (@ <group>/<project>) and hand off ownership as necessary. This doesn't break old consumers and it allows for a pretty graceful migration path (if you want new updates, change your version) -- can eve be helped with marking package as deprecated or repo as archived and what not.
- littlestymaar 7y ago> It should've been `@shinn/purescript` and the compiler developers just create their own `@whatever/purescript`. And how is a user supposed to make the difference between @legit_dev/package_name and something like @nlegit_dev/package ? Namespacing makes name-squatting way easier, not harder.