Is it time for a Lock file? #201
HeyItsGilbert
started this conversation in
General
Replies: 2 comments 1 reply
|
I don't understand the benefit vs setting the version in requirements.json? |
1 reply
|
+1 on this, and my vote is for locking over pinning. @bchap1n a pin says what you asked for. A lock says what you actually got, including the transitive stuff you never asked for. That’s where I keep seeing the supply chain issues happen. The pattern in the npm incidents is almost always a sub-dependency nobody had eyes on. PowerShell isn't immune. RequiredModules in a manifest can be as loose as the author felt like making it that day. The other half is that pins rot. Nobody bumps requirements.json for eight months, then someone updates everything at once and spends a day figuring out which of eleven modules broke the build. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Always installing
Latestcan be problematic. The reality is that there are more and more cyber threats where assuming that latest is the best approach is going to eventually shoot us in the foot. Currently PSDepend doesn't have a lock file. This sort of falls onto the package manager to implement, but the problem is not every package manager supports it. So the question is: Do we write an intermediate layer to create a lock system for things like PowerShell modules?I am creating this as a discussion because I want to try to get feedback from the community before we just start to implement. I suspect this is not difficult to implement (famous last words), but I'm sure there are plenty of foot guns that I'm not considering.
What is a lock file?
Lock files are files that store a resolved version of the intended package. For example, if you want version
>2.1and version2.5is available, the lock file would update to point to the specific version (e.g.2.5.0). In future calls, you can restore to a specific version and/or update to the new latest. They also document any dependencies and their resolved version. So even a sub-dependency that has a similar minimum version would get resolved and saved.See node's
package-lock.jsonfor a real life example: https://docs.npmjs.com/cli/v12/configuring-npm/package-lock-jsonWhy have lock files?
With transitive dependencies, you can run into the issue that a previously working build begins to fail because a downstream dependency changed. This can be difficult to diagnose when dependency versions are dynamic.
Supply chain attacks are on the rise even with package managers that make it easier to control dependancies. This has been very prevalent in the npm world: https://unit42.paloaltonetworks.com/npm-supply-chain-attack/
All reactions