Recently I looked at the state of 2FA support across package managers. 2FA adds a layer of security by requiring two sources of authentication from maintainers when publishing packages. This helps open source communities avoid supply-chain attacks by protecting packages from their author to their repository.
2FA is great, but hinges upon the package repository being secure, and isn’t an end-to-end verification that a package came from its maintainer.
But there’s another way that isn’t as dependent upon the package repository: cryptographic signing of packages. Let’s take a look at which platforms support package signing.
Package signing is the act of an open source package (repo, binary, recipe, etc.) being cryptographically signed with a private key so that downstream users can verify the package with a public key.
Across language ecosystems, there are generally two types of package signing:
Whether you’re setting up a new codebase on your developer machine or deploying a webapp to your servers, you’re probably downloading dozens—or hundreds—of open source packages. It’s impractical to comb through every line of code to make sure the package you received was not tampered with. Package signing offers a way to say I trust this maintainer and I am guaranteed that this code was uploaded by them.
Let’s try to classify what each package manager does currently:
If you read through the discussions linked to above, package signing is indeed a lofty goal and challenging to get right. So is it worth it, and could it prevent any classes of exploits? You can find some examples of supply chain attacks from the past decade documented here and here. Those lists contain some examples of repository account takeovers and other exploits that could be mitigated using package signing.
Visit our site to learn more about the Tidelift Subscription and how we work with maintainers.
Here are some more writeups on package signing that are useful or that we found interesting:
* GitHub allows commits and tag signing and will label them as verified-or-not, although there are no signatures/checksums available for release zip/tar archives.
** GitLab allows commit signing and labels them as verified or not, but not for builds.
*** BitBucket Server allows commit and tag signing -- while Bitbucket Cloud does not yet -- but not for builds.