←back to thread

441 points longcat | 1 comments | | HN request time: 0.221s | source
Show context
f311a ◴[] No.45038992[source]
People really need to start thinking twice when adding a new dependency. So many supply chain attacks this year.

This week, I needed to add a progress bar with 8 stats counters to my Go project. I looked at the libraries, and they all had 3000+ lines of code. I asked LLM to write me a simple progress report tracking UI, and it was less than 150 lines. It works as expected, no dependencies needed. It's extremely simple, and everyone can understand the code. It just clears the terminal output and redraws it every second. It is also thread-safe. Took me 25 minutes to integrate it and review the code.

If you don't need a complex stats counter, a simple progress bar is like 30 lines of code as well.

This is a way to go for me now when considering another dependency. We don't have the resources to audit every package update.

replies(17): >>45039115 #>>45039225 #>>45039464 #>>45039724 #>>45039994 #>>45040021 #>>45040056 #>>45040113 #>>45040151 #>>45040162 #>>45040972 #>>45041479 #>>45041745 #>>45044165 #>>45045435 #>>45045983 #>>45052913 #
wat10000 ◴[] No.45039225[source]
Part of the value proposition for bringing in outside libraries was: when they improve it, you get that automatically.

Now the threat is: when they “improve” it, you get that automatically.

left-pad should have been a major wake up call. Instead, the lesson people took away from it seems to have mostly been, “haha, look at those idiots pulling in an entire dependency for ten lines of code. I, on the other hand, am intelligent and thoughtful because I pull in dependencies for a hundred lines of code.”

replies(2): >>45039649 #>>45040119 #
chuckadams ◴[] No.45040119[source]
So, what's the acceptable LOC count threshold for using a library?

Maybe scolding and mocking people isn't a very effective security posture after all.

replies(2): >>45040731 #>>45042129 #
tremon ◴[] No.45040731[source]
Scolding and mocking is all we're left with, since two decades worth of rational arguments against these types of hazards have been dismissed as fear-mongering.
replies(1): >>45040841 #
chuckadams ◴[] No.45040841[source]
I don't think we're going to reach a point where "don't use dependencies at all" is a rational argument for most projects.
replies(1): >>45042009 #
tremon ◴[] No.45042009[source]
It's a good thing then that was not among the rational arguments I was referring to. Do you have other straw men on offer?
replies(1): >>45043354 #
1. ◴[] No.45043354[source]