ossf / package-manager-best-practices

Collection of security best practices for package managers.
Apache License 2.0
159 stars 19 forks source link

RC npm: install scripts and reproducible installation #14

Closed calebbrown closed 2 years ago

calebbrown commented 2 years ago

From looking at data for packages coming through the Package Analysis project I see a lot of NPM packages installing artifacts via preinstall, postinstall and install scripts.

These can be not "reproducible" because:

Some examples:

It is probably worth addressing this scenario in the doc to ensure people are aware of this behavior when trying to ensure their package install is reproducible.

lirantal commented 2 years ago

Just wanting to note here that with npx you can surely specify a version modifier and it's not always latest, even though that is indeed the default. (reference: npx docs)

I'm not entirely sure though what is the point of raising these. As in, these aren't concerns end-users can do something about.

jeffmendoza commented 2 years ago

Agree, there is not much a user can do about it. The point of this section is to describe why a lockfile is important to an application, not to get into the install scripts issues.

We've discussed in other issues, that it is not really feasible at this point to recommend that users use --ignore-scripts or even avoid packages with install scripts as they are very prevalent in the ecosystem and required by those packages. We'll close this out for now and keep an eye on the scripts space for advances.