News for hackers. Stuff that matters.
Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Thursday June 25, 2020 @09:26PM (#23647817)
Yes, in depth. Not just the packages but their dependencies as well.
Re:Ask HN: Does anyone investigate open source packages befo... by gitgud on Thursday June 25, 2020 @11:49PM (#23648499)
Really? What about all the dependencies from those dependencies?...

For example, our company is working on an app that has 82 npm dependencies and over 17,000 resolved npm packages...

It's absolutely ridiculous to investigate all of them... but it's also necessary if you want to be sure...

Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Friday June 26, 2020 @10:05AM (#23652083)
> Really? What about all the dependencies from those dependencies?...

Yep, all the way to the end.

I got the idea from a book called "Hollywood Secrets of Project Management Success" by James R. Persse. It's two books interleaved really, one is just a standard pitch for Agile methods (IMO), but the other is a presentation of the process that large film studios use to make movies. The movie industry is ~100 years old and mostly very good at bringing in projects on time and under budget.

Somewhere in there he talks about how they'll track their dependencies in a kind of "portfolio", I forget the details, but it translates in IT to a "dependency portfolio" and you would (if you're large enough) have an actual "Deps Dept." and a Deps Manager whose sole job is tracking dependencies and their updates and patches, etc.

> working on an app that has 82 npm dependencies

Ach! Well, see, there's your problem right there. :-)

Seriously though, one of the benefits of a dependency portfolio is to help you know when your system has gotten out of hand. The problems are still there even if you don't look at them, eh?

> It's absolutely ridiculous to investigate all of them... but it's also necessary if you want to be sure...

Ya feel. ;-)

Re:Ask HN: Does anyone investigate open source packages befo... by gitgud on Friday June 26, 2020 @09:54PM (#23658891)
Thanks for the response, that's an interesting way to deal with it. How do you verify a dependency? Do you literally examine the source code? Make sure the build is reproduced? or just the meta data? (downloads, stars) has the portfolio actually prevented any vulnerabilities?

It's pretty common for JS projects to have thousands of transitive dependencies, I'm not sure keeping a private portfolio is much use. The entire open-source ecosystem is built on the foundation of trust, if I use a package that's being used by 500 other packages, I can have a high degree of certainty that the package is safe, and by locking the dependencies with yarn.lock I can prevent sneaky updates from entering the system.

Anyway maybe I'll look into the dependency portfolio, see how it goes.

Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Saturday June 27, 2020 @10:53AM (#23662190)
Cheers!

> How do you verify a dependency? Do you literally examine the source code?

Yeah. It's part of the overhead of using the software. You also look at the history of bugs and how they were handled.

> It's pretty common for JS projects to have thousands of transitive dependencies

Yeah, I know, and it's bonkers IMO.

> The entire open-source ecosystem is built on the foundation of trust

In practice, yes, but in theory, no. The whole idea is that you get to see the code you're running, because the guys who wrote it are clowns. Free Software started when RMS wanted to fix his printer and Xerox said, "No."

> if I use a package that's being used by 500 other packages, I can have a high degree of certainty that the package is safe

I think history has shown that that reasoning is at best probabilistic, eh? You're gambling.

Now, of course, there are limits. Some things get a pass. Do we audit the source of the bash shell? No, despite the fact that it's maintained by a single volunteer.

> Anyway maybe I'll look into the dependency portfolio, see how it goes.

Check out that "Hollywood Secrects" book I mentioned.

Re:Ask HN: Does anyone investigate open source packages befo... by amoitnga on Sunday June 28, 2020 @01:26PM (#23670393)
Thanks for sharing. It would be very interesting to know some of the examples when it payed off. Could you please share?
Re:Ask HN: Does anyone investigate open source packages befo... by seanwilson on Friday June 26, 2020 @12:11PM (#23653598)
How long does it take you to do this for e.g. all the dependencies for a bare bones Angular, Vue or React app?
Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Friday June 26, 2020 @01:24PM (#23654476)
I couldn't begin to estimate. (We don't use those.)
Re:Ask HN: Does anyone investigate open source packages befo... by seanwilson on Friday June 26, 2020 @02:44PM (#23655441)
I just don't see how anyone could realistically look at all the lines of code that any nontrivial JavaScript app relies on in any depth.

I'm sure most people don't review the code for their operating system, drivers, web server, compiler, browser etc. but they do assess if the entities that write + support them are worth trusting. This is likely the only realistic approach for complex JavaScript apps also.

Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Saturday June 27, 2020 @11:04AM (#23662262)
> I just don't see how anyone could realistically look at all the lines of code that any nontrivial JavaScript app relies on in any depth.

Right. And that's really bad.

> I'm sure most people don't review the code for their operating system, drivers, web server, compiler, browser etc.

Right, but some people do. Hire one of them. (And if your "props dept." can't keep up with the changes to all the things that's also really bad.)

> they do assess if the entities that write + support them are worth trusting.

No one is a magic code elf. (Some people come close. Fabrice Bellard might count. But even that worthy commits bugs.)

Like I said in a sib comment, yeah, some things get a pass. Bash shell for example. Then again, remember e.g. "heartbleed"?

Re:Ask HN: Does anyone investigate open source packages befo... by seanwilson on Saturday June 27, 2020 @02:39PM (#23663702)
> > I just don't see how anyone could realistically look at all the lines of code that any nontrivial JavaScript app relies on in any depth.

> Right. And that's really bad.

> > I'm sure most people don't review the code for their operating system, drivers, web server, compiler, browser etc.

> Right, but some people do. Hire one of them.

The interesting question isn't if you can do it, it's when should you, to what extent, and how much it will cost.

"Always do it, do it in-depth, the time consumed isn't important and the budget isn't important" is a bad approach for example and isn't helpful to the OP.

Successful software development is all about making appropriate tradeoffs - you're not going to get very far by conducting your own OpenSSL audit when all you want to do is write a todo web app.

Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Saturday June 27, 2020 @07:31PM (#23665556)
Hey I'm just answering the question, yeah? We do it. It's not that hard. You pay the overhead upfront and have fewer surprises. Read the "Hollywood Secrets" book, it makes a lot of IMO good points.

I once helped a guy build a go-cart out of an old lawn mower engine and a bed frame. It was a lot of fun. We didn't do any research, we just made it.

If I'm provisioning a commercial fleet (for a delivery service or something) I'm going to do my homework to make sure the cars we deploy are low-maintenance, high-mileage, with a good safety record, etc.

Re:Ask HN: Does anyone investigate open source packages befo... by jfoster on Friday June 26, 2020 @05:35AM (#23650234)
On what cadence do you do this? Every release?
Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Friday June 26, 2020 @10:14AM (#23652176)
The "deps portfolio" gets updated whenever the deps change. In practice the flow goes like this:

0. A dev wants to use a new dependency, likely after experimenting with it a little bit.

1. Preliminary evaluation, which includes a transitive dependency scan. ("Too many dependencies" is a valid fail condition all on it's own.)

2. If everything looks good we bring it and it's deps into our internal repo. This includes the plumbing to add it to our dev|test|production envs. (Using Docker or whatever.)

3. Now the devs can use it in code destined for prod. There's a nice page in the company wiki that lists the exact version(s) with links to the docs, bug trackers, mailing lists, etc. and also the internal company lore for that package.

It's tight.

- - - -

This might seem like a lot of work up front, but think about all the work it saves down the line.

Re:Ask HN: Does anyone investigate open source packages befo... by jfoster on Friday June 26, 2020 @10:56AM (#23652662)
When one of the transitive dependencies fixes a security issue, is it then re-evaluated prior to being updated in the internal repo?

I'm guessing you work at a pretty large tech company. It seems wasteful that so many companies might be replicating this work. I wonder if there might be the opportunity for a body to review & approve packages on behalf of many companies. Perhaps npm will eventually move in this direction.

Re:Ask HN: Does anyone investigate open source packages befo... by carapace on Friday June 26, 2020 @01:33PM (#23654592)
> When one of the transitive dependencies fixes a security issue, is it then re-evaluated prior to being updated in the internal repo?

Yes, but this is typically pretty low overhead. And when it's not, it usually means there is some issue that has to be addressed anyway.

> I'm guessing you work at a pretty large tech company.

I did once, but right now "we" is a tiny startup (we're using Elm and Erlang.)

> I wonder if there might be the opportunity for a body to review & approve packages on behalf of many companies.

Ideally, that's what Free/Open Source Software would be, eh?

In the old days there were "sysadmins", System Administrators, who handled a lot of this sort of thing.