this post was submitted on 31 Jan 2024
118 points (87.3% liked)

Today I Learned

17721 readers
303 users here now

What did you learn today? Share it with us!

We learn something new every day. This is a community dedicated to informing each other and helping to spread knowledge.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must begin with TIL. Linking to a source of info is optional, but highly recommended as it helps to spark discussion.

** Posts must be about an actual fact that you have learned, but it doesn't matter if you learned it today. See Rule 6 for all exceptions.**



Rule 2- Your post subject cannot be illegal or NSFW material.

Your post subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Posts and comments which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding non-TIL posts.

Provided it is about the community itself, you may post non-TIL posts using the [META] tag on your post title.



Rule 7- You can't harass or disturb other members.

If you vocally harass or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.

For further explanation, clarification and feedback about this rule, you may follow this link.



Rule 8- All comments should try to stay relevant to their parent content.



Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here.

Unless included in our Whitelist for Bots, your bot will not be allowed to participate in this community. To have your bot whitelisted, please contact the moderators for a short review.



Partnered Communities

You can view our partnered communities list by following this link. To partner with our community and be included, you are free to message the moderators or comment on a pinned post.

Community Moderation

For inquiry on becoming a moderator of this community, you may comment on the pinned post of the time, or simply shoot a message to the current moderators.

founded 1 year ago
MODERATORS
all 34 comments
sorted by: hot top controversial new old
[–] JoMiran@lemmy.ml 152 points 9 months ago (3 children)

TL;DR: A patent and trademark agent and NPM bullied an Open Source Dev, so the Dev deleted his code from NPM as is his right. The internet broke. NPM restored the code against the dev's wishes. Corpos win...as always.

[–] ramble81@lemm.ee 77 points 9 months ago (1 children)

I’d say the bigger issue was people live-linking to the files rather than downloading and using a version controlled copy they can control.

[–] JoMiran@lemmy.ml 11 points 9 months ago

I love how it broke React.

[–] Aatube@kbin.social 1 points 9 months ago

“Bullied”? I mean, the open source app the trademarker wanted to replace wasn’t popular either, and I don’t see how the heck “kik” could be related to something for creating templates. Neither do I see it for messaging, but that is a trademark.

In this case, we believe that most users who would come across a kik package, would reasonably expect it to be related to kik.com.

IMO, the dev was the asshole in that case.

[–] infeeeee@lemm.ee 45 points 9 months ago

Original article not via pocket: https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code

It's the left-pad npm incident, it was a big news back than, it has its own section on wikipedia: https://en.wikipedia.org/wiki/Npm#Dependency_chain_issues

[–] ptz@dubvee.org 42 points 9 months ago* (last edited 9 months ago) (4 children)

I always reel in horror when projects have tiny, 'negligible to implement yourself' functions like these as dependencies. See also: is-even 🙄

Edit: is-even has a dependency on is-odd which has a dependency on is-number. 🤦‍♂️

[–] cbarrick@lemmy.world 12 points 9 months ago

I think is-odd is intentionally a reference to / satire of leftpad

[–] LazaroFilm@lemmy.world 10 points 9 months ago (1 children)

At this point it’s just a joke. Is there a npm for console log? I’ll have to check.

[–] pennomi@lemmy.world 9 points 9 months ago* (last edited 9 months ago) (1 children)

JavaScript is a dangerous shitshow for this exact reason. Dependencies are a security and stability nightmare.

[–] ptz@dubvee.org 9 points 9 months ago* (last edited 9 months ago) (2 children)

Eh, I'd say any language that offers a package repository is just as susceptible. I'm neither pro- nor anti- dependency, but I do always try to keep them to an absolute minimum regardless of what environment I'm working in. Sometimes it makes sense to not reinvent the wheel.

[–] pennomi@lemmy.world 8 points 9 months ago

Yes, but other languages have exponentially fewer packages that install when you add something, making the attack vector smaller and easier to monitor.

The best way to fix this is for library authors to avoid installing as many sub-dependencies as possible (is-odd, being an obvious example). But that’s a fundamental culture problem.

[–] JoMiran@lemmy.ml 2 points 9 months ago* (last edited 9 months ago)

This is why I only code in Assembly. /jk

[–] Gork@lemm.ee 7 points 9 months ago (1 children)
[–] surewhynotlem@lemmy.world 10 points 9 months ago

Yes you can, just don't odd

[–] Blue_Morpho@lemmy.world 28 points 9 months ago* (last edited 9 months ago) (1 children)

The only part of the story that I'm pissed at is NPM corporation restoring content on their server that they didn't own and published it to millions for profit.

Koçulu removed left pad. It was his code.

Can you imagine the lawsuits if when Disney pulled the license for Avengers on Netflix, Netflix responded with:

"Millions of customers got errors that Marvel Avengers is missing. So we put Avengers back on our servers."

[–] Dirk@lemmy.ml 25 points 9 months ago (1 children)

11 lines of code shouldn't be a package.

[–] xor@infosec.pub 7 points 9 months ago (3 children)

you should see the "is_odd" package...

it's like, return (num%2)? true:false

[–] Dirk@lemmy.ml 11 points 9 months ago (2 children)

People using this deserve that their code breaks. Absolutely ridiculous.

Neither this, nor the leftpad thing, nor this is-even “package” are things I would even think about for a second before just writing it on my own. I wouldn’t even consider those features (let alone packages to depend my code on!) but basic programming.

[–] Ephera@lemmy.ml 8 points 9 months ago (1 children)

Problem is when you accidentally pull it in as a transitive dependency...

[–] Dirk@lemmy.ml 7 points 9 months ago

Yeah :( This also is why such nonsense “breaks the Internet” …

[–] xor@infosec.pub 4 points 9 months ago (1 children)

i just don't see how npm is letting this happen...
im going to write an npm module called "true" that just returns true...

[–] Dirk@lemmy.ml 6 points 9 months ago

… and that has 4 dependencies on it’s own!

[–] vrighter@discuss.tchncs.de 3 points 9 months ago (1 children)

and that's still too verbose. it should be (num % 2) != 0

[–] xor@infosec.pub 1 points 9 months ago (1 children)
[–] 2deck@lemmy.world 1 points 9 months ago

Name checks out

[–] rikudou@lemmings.world 13 points 9 months ago

I remember it live as it was happening. It was fun.

[–] CrayonRosary@lemmy.world 2 points 9 months ago

Nice run on sentence in your title. Great job.

[–] pHr34kY@lemmy.world 2 points 9 months ago

It's 11 lines of trash code too.

The way the function reallocates memory would bring your computer to a crawl on a large string.