-
Notifications
You must be signed in to change notification settings - Fork 396
Support authenticity verification for downloaded binaries #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fixes bazelbuild#15. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* refactor `httputil.DownloadBinary` to download and store signature file * extract authenticity verification logic into a separate `VerifyBinary` function * perform authenticity verification in `downloadBazelIfNecessary`, after integrity check * it allows us to keep verification logic in one place * failure of authenticity check is clearly handled in the same way as failure of integrity check: downloaded Bazel left in CAS, but the mapping file is not created in metadata
…sabling of authenticity check
…itly using an alternative verification key. It can be useful if * the embedded verification key expired, but it's impossible to update bazelisk for some reason * Bazel is downloaded from the fork which uses an alternative PGP key
… because golang.org/x/crypto is deprecated and unmaintained See https://pkg.go.dev/golang.org/x/crypto/openpgp for details
60da2d9 to
9d67949
Compare
0117588 to
989125c
Compare
…o:embed to make it available in the source code
989125c to
bb6e9ad
Compare
|
@philwo, @meteorcloudy, @fweikert, please, take a look at it. |
|
It would be ok, if this PR is reviewed deeply after #192, because it's initially based on #192. |
Bazel publishes detached signature files together with binaries and source code for each release.
It looks like bazelisk could guarantee much better security if it verifies the corresponding signatures for downloaded artifacts. This functionality was requested more than 7 years ago in #15.
There were a couple of attempts to implement this feature - #17, #192. But none of them was accepted after all.
I decided to take #192 from @PiotrSikora as the base, because an approach with signature verification in the code looks much more attractive than launching external tools. I reworked it quite drastically and supported additional features, so it's possible to skip verification or provide an alternative verification key now.
I also switched from
golang.org/x/cryptotogithub.com/ProtonMail/gopenpgp/v3, becausegolang.org/x/crypto/openpgpis deprecated and unmaintained (see https://pkg.go.dev/golang.org/x/crypto/openpgp for details).