Re:How I write back ends
by fpereiro on Wednesday January 22, 2020 @07:49AM
(#22117043)
I believe that npm no longer allows for republishing existing versions. Wouldn't this restriction remove this vulnerability altogether?
[ Parent
| on HN ]
It won't protect against a newer version of an established library introducing malicious behaviour.
Re:How I write back ends
by bluehatbrit on Wednesday January 22, 2020 @09:57AM
(#22118014)
This is correct, the few dependencies you would use would need to also target very specific versions to achieve the same.
Lock files are used to lock dependency versions all the way down your dependency tree, not just your immediate dependencies.
Unfortunately this seems to be the case; lockfiles would be unnecessary only if all your dependencies (and their dependencies, recursively all the way down) reference explicit versions, the risk being that a new malicious version would be published. I'll research if there's a workaround.
Thanks everyone for pointing out this issue.
Re:How I write back ends
by bluehatbrit on Thursday January 23, 2020 @12:57PM
(#22129891)
In my opinion a lock file really is the "work around", I don't see a huge issue in using them since it's given for free by npm and yarn with no additional overhead.
Re:How I write back ends
by jessaustin on Wednesday January 22, 2020 @08:45AM
(#22117461)
You can specify exact versions, but your deps might wildcard with "~" or "^" or they might specify a range of versions. Thus, a new dep of a dep might be installed the next time you update.
I wonder whether one of the npm alternatives has a "--sane" mode that would always pick the oldest possible dep...
Re:How I write back ends
by t0astbread on Wednesday January 22, 2020 @09:32AM
(#22117818)
Why the oldest possible?
Re:How I write back ends
by jessaustin on Wednesday January 22, 2020 @10:17AM
(#22118202)
Thread hypothesis is that we want to avoid breakage due to automatic dependency updates. So, don't update dependencies automatically. Now sure, if you tell the tool to update a particular dep, it will force second- and higher-order deps to update to compatible versions. It will always use the oldest compatible version, so nothing will get broken in surprising fashion. This seems strange to people who've used mostly npm and node, but tools for other languages have this policy.
Re:How I write back ends
by t0astbread on Wednesday January 22, 2020 @04:37PM
(#22122316)
I see. I've never heard of that before, thanks for sharing!