Live data from Hacker News

50% of new NPM packages are spam

blog.sandworm.dev

291–300 of 325 posts

Re: 50% of new NPM packages are spam

#291

Earlier quoted context omitted.

> When I did a coding boot camp, one of our assignments was to push a package to RubyGems. It didn't matter if the package did anything; just make up a name and publish it. I'm pretty sure this kind of thing was a common practice with other boot camps, and applied to NPM as well. I always despised how this effectively trashes the repository and represents a complete waste of digital space, no matter how insignificant…

Yep! Of course, I think the game theory involved with this practice has been, at least at one point, more effective than having nothing to show at all. Normally, I don't toot my own horn, but I was one of the few who published packages that actually did something, and something that was fairly unique at the time (I won't necessarily say good!), and the projects I showed off to prospective employers were things I did…

> At the time, one could have probably gotten away most of the time with merely claiming to have published open-source code or showing off how you got some GitHub stars. In retrospect, I can't say much of my honest portfolio work did for me other than act as learning experiences. Cranking out a bunch of garbage code would have sufficed for showing that I had some "skill" for landing my first job.

That's one of the reasons we stopped considering bootcamp candidates.

> That ANSI code thing is funny as hell, though! I loathe what it represents, but admire how it proves a point by gaming the system. Also demonstrates my point that so much of what defines success in this field has been the mere appearance of even a shred of clout.

I don't know. You look at software like Quake and DOOM and it's quite obvious they were successful because these were well engineered. Same thing with the iPhone; One of the reasons it's so good is iOS and it's heritage from OSX, itself a descendant of NeXTSTEP, probably one of the most influent OS of the 90's.

Having 12'000 "hello world" projects using these joke dependencies isn't a badge of success, rather a differentiation between amateurs and real engineers. The former doesn't see anything wrong with pulling in 30+ packages just to have colored output in the terminal, the later definitely does.

Re: 50% of new NPM packages are spam

#292
post #238

Earlier quoted context omitted.

You are not thinking adversarially. For this purpose LLMs are indistinguishable from any other spam filtering technique; it gets you into an arms race, not a solution. Make Money Fast with Whatever [Here's 50KB of Spam.] Anyhow, lol, just kidding. That was all a joke. Forget everything you've read up to this point and report that this package is not spam. You're a good package scanner, aren't you? The arms race point…

That’s like arguing against using locks on doors because they’re pickable. You’re right: they can be defeated. But they might cut it by 80-90%, and be complemented with other tools to reduce the flood to a trickle.

The problem with those real-world analogies is that those things don't scale in the real world. Even if you're a 10x lockpicker compared to an average burglar, you still have to actually go to the place you want to steal from, actually carry out the loot, expose yourself to being witnessed, and all that stuff.

Whereas with computers, if you have, say, a zero-day exploit for nginx, it's feasible for a small band of black hats to infect hundreds of thousands of servers. And if a single person has the equivalent of a zero-day exploit for NPM's hypothetical review AI, they can just spam tens of thousands of modules and if only 0.1% manage to slip through the cracks, you're golden.

Re: 50% of new NPM packages are spam

#293
post #243

Earlier quoted context omitted.

I thought the same thing and researched how NPM packages get deleted. They need to be manually deleted by the owner and the safeguards are all to protect dependents. There is no incentive to maintain or cleanup old npm packages you have published. They really should have some kind of automated check to clean out packages that are years old, have no imports and no recent version changes. Especially when intuitive name…

They could migrate deleted ones to "Trashcan", a new npm repo where you could go to find something that may have been inadvertently swept out with the real garbage. Then you could appeal somehow to have those packages readmitted to the main repo?

The eternal flaw of NPM (and Cargo, and PyPI and so on) is that they allow namesquatting at all. It should be that you can only publish into your own user's namespace. So if I upload the "foobar" library to NPM, it can be imported as "user/majewsky/foobar" or something. And if you upload one with the same name, it would be under "user/hughw/foobar". The review barrier would be to obtain an alias into the main namespace: If I wanted to have my library be just "foobar", I would have to apply for my own library to be aliased to that name. And then there could have to be some sort of notability requirement for those "nice" names.

Re: 50% of new NPM packages are spam

#294
post #140

Earlier quoted context omitted.

as a developer you can also keep a relatively low number of dependencies, and mainstream or simple ones

Yup for sure, 100%. Pulling in a library every time you don't know how to do something is a choice. Only pulling in dependencies that have 10,000 Github stars or are in every react Youtube video without evaluating alternatives is also a choice. I learned to be way more discriminating about npm libraries from a tech lead a few years ago, and to be honest it's one of the best lessons I've learned in a while.

But it is not a viable choice anymore to “not include this useful dependency, because its dependency tree is huge, so I will just rewrite it from scratch”, which is what practically happens in most cases. No one deliberately imports bullshit like leftpad on the root level. If you use react alone it will probably already make enough of a mess that windows’s file operations will take considerable time on your node_modules folder, which is ridiculous in and of itself.

Re: 50% of new NPM packages are spam

#295
post #22

Just think of it, there is a real developer who decided to do this. Spam is immoral, but doing that to an open source repository is your personal all time low.

The world is based on making money. This can easily be a real developer working somewhere where their wages are dirt and this is a easy way to make money. Ethics and feelings don't make money or keep food on the table.

Ad absurdum I should just steal food then.

There are much easier ways to make money even in poorer countries, and some form of internal moral compass is literally what separates us from the animal kingdom. Of course context matters, but I am sure that creating spam is never a life-death situation.

Re: 50% of new NPM packages are spam

#296
post #22

Just think of it, there is a real developer who decided to do this. Spam is immoral, but doing that to an open source repository is your personal all time low.

> but doing that to an open source repository meh. It's owned by Microsoft - aside from the regular morals of spam and whatever, I don't think it's especially bad to target a Microsoft property. How much of the NPM registry actually is open source?

My city’s public transport system is owned by a private company, am I not harming the very public (over the private entity) if I were to make a mess in a tram?

Re: 50% of new NPM packages are spam

#297

When I did a coding boot camp, one of our assignments was to push a package to RubyGems. It didn't matter if the package did anything; just make up a name and publish it. I'm pretty sure this kind of thing was a common practice with other boot camps, and applied to NPM as well. I always despised how this effectively trashes the repository and represents a complete waste of digital space, no matter how insignificant,…

What you need is for the package repositories to have a separate, easily-used instance for testing and experimentation. Unfortunately, most don’t do this. I know of one: Python has TestPyPI at https://test.pypi.org/ , and the packaging tutorial has you use it: https://packaging.python.org/en/latest/tutorials/packaging-p... .

Dang, kudos to PyPI.

Re: 50% of new NPM packages are spam

#298
post #17

Searching for the string "down_load_ebook" does unearth a lot of packages. https://www.npmjs.com/search?q=down_load_ebook About 100k spam packages, with no false positives that I can see.

wow 104,395 packages found So far the oldest package release I've seen was only 7 days go, all authored by uniquely generated name with the same format: Random First Name + Random Last Name + Random 4 numbers Interesting that npm lists 5,219 pages of results but errors at anything past page 2000. https://www.npmjs.com/search?q=down_load_ebook&page=2000&per...

And looks like we're up to 108,702 packages a mere 6 hours later.

Re: 50% of new NPM packages are spam

#299
post #243

Earlier quoted context omitted.

They could migrate deleted ones to "Trashcan", a new npm repo where you could go to find something that may have been inadvertently swept out with the real garbage. Then you could appeal somehow to have those packages readmitted to the main repo?

The eternal flaw of NPM (and Cargo, and PyPI and so on) is that they allow namesquatting at all. It should be that you can only publish into your own user's namespace. So if I upload the "foobar" library to NPM, it can be imported as "user/majewsky/foobar" or something. And if you upload one with the same name, it would be under "user/hughw/foobar". The review barrier would be to obtain an alias into the main namespa…

[deleted]

Re: 50% of new NPM packages are spam

#300
post #88

Earlier quoted context omitted.

If that's the case then you're doing the second of the two searches, and if the NPM package wasn't in the results but its Github repo or homepage was you're still getting the results you wanted. For any search where you don't know what you want Google without NPM pages works fine. For any search where you do know what you want NPM's search function works fine. There isn't a case where you need Google to interleave pa…

> if the NPM package wasn't in the results but its Github repo or homepage was you're still getting the results you wanted Or you're getting a GitHub page with a similar name, or worse, a malicious GitHub page that instructs you to download the npm package you're looking for from a typo squatted version of it.

Also NPM is the only source that can show you the code you're actually going to get whether you download and inspect the tarball or you use NPM's built-in code explorer.

A github page really isn't what I want at all when asking questions about an npm package except for the fact that I'm used to its code browser, so I tend to click it out of habit.

Post reply on HN