News for hackers. Stuff that matters.
Re:Npm Audit: broken by design? by esprehn on Thursday July 08, 2021 @12:40AM (#27768545)
Hope do you make your builds hermetic and reproducible without package locks?
Re:Npm Audit: broken by design? by junon on Thursday July 08, 2021 @01:42AM (#27768779)
Your builds are not reproducible with anything related to npm. Neither npm nor any bundler that I'm aware of guarantees that.

Unless we're not talking about the same reproducibility property. Also I don't know what "hermetic" means in this context but I doubt it's anything that npm solves correctly.

Re:Npm Audit: broken by design? by wickedsickeune on Thursday July 08, 2021 @03:50AM (#27769320)
There is a way, but it's troublesome. Create a docker image with installed node modules. Save it, and from then onwards you have frozen node modules. If you need a new dependency/updated version you need to create a new image and npm i.
Re:Npm Audit: broken by design? by junon on Thursday July 08, 2021 @05:06AM (#27769702)
That's absolutely no different than just installing and not re-installing. Docker adds nothing in this case.

Not re-building doesn't make your build reproducible. It just means that you're... not building. If I save the result of a single iteration of an RNG, I can't claim that the RNG always produces the same result because I saved the result somewhere...

Re:Npm Audit: broken by design? by tekknik on Thursday July 08, 2021 @10:04AM (#27772083)
Where did they say they’re not building? Building your app does not mean you install the modules every time. Some apps are so large they have to be split into chunks / layers anyway. In golang this used to be the way you’d add deps, check the entire source into your version control.
Re:Npm Audit: broken by design? by junon on Thursday July 08, 2021 @10:26AM (#27772356)
Building the same project even without re-installing node modules has absolutely no guarantee of reproducibility.
Re:Npm Audit: broken by design? by tekknik on Friday July 09, 2021 @09:06AM (#27783270)
Oh please explain what’s different. The entire code chunk is the same. How is that not reproducible?
Re:Npm Audit: broken by design? by junon on Friday July 09, 2021 @09:19AM (#27783375)
The code being the same != reproducible. Build tools can incorporate e.g. build timestamps into the built artifacts, or randomize the output for e.g. pattern scanning/patch deterrence.

The input is irrelevant. I think you should have a look at what reproducible builds really are before evangelizing them.

Re:Npm Audit: broken by design? by tekknik on Saturday July 10, 2021 @08:28AM (#27792921)
So you’re incrementing a timestamp, but the code doesn’t change and it’s super important you change the timestamp and this is a reproducible build?

A reproducible build means anybody on any machine can build the same thing someone else has on theirs. That’s it.

Re:Npm Audit: broken by design? by junon on Saturday July 10, 2021 @10:13PM (#27797982)
> A reproducible build means anybody on any machine can build the same thing someone else has on theirs. That’s it.

No. A reproducible build is a guarantee that two builders of the same codebase, or the same codebase built multiple times, will result in a bit-for-bit identical of all other builds of the same codebase, every time, guaranteed.

*There are no Node.js-related build systems in mainstream use I am aware of that have any such guarantees. No, docker does not make any such guarantees. No, just because you pinned dependencies does not make that guarantee. No, just because you archived the codebase and vendored your dependencies does not make that guarantee.*

Please educate yourself before dying on a hill for a topic you're misrepresenting entirely.

Re:Npm Audit: broken by design? by tekknik on Sunday July 11, 2021 @09:35AM (#27800666)
> No. A reproducible build is a guarantee that two builders of the same codebase, or the same codebase built multiple times, will result in a bit-for-bit identical of all other builds of the same codebase, every time, guaranteed.

That's what I said :)

> Please educate yourself before dying on a hill for a topic you're misrepresenting entirely.

I'll say the same. I've only been doing this for near 30 years ;)

But here you go, here's one example:

1) copy source to destination directory 2) run private npm 3) use private npm repo 4) freeze private npm repo 5) use npm install like normal

here's another:

1) check all node_modules directories into version control 2) ensure no native packages are used 3) copy entire directory structure to destination dir

You are clearly inexperienced, or very focused on node.js only.

Re:Npm Audit: broken by design? by jahewson on Thursday July 08, 2021 @01:05AM (#27768634)
Ha ha, our builds are not “hermetic and reproducible” with package locks. Why? Caching.
Re:Npm Audit: broken by design? by tekknik on Thursday July 08, 2021 @10:09AM (#27772135)
How does caching effect this? are you’re devs / build processes not doing clean installs?