Skip to content

Conversation

@valco1994
Copy link
Contributor

@valco1994 valco1994 commented Jan 26, 2026

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/crypto to github.com/ProtonMail/gopenpgp/v3, because golang.org/x/crypto/openpgp is deprecated and unmaintained (see https://pkg.go.dev/golang.org/x/crypto/openpgp for details).

PiotrSikora and others added 11 commits January 27, 2026 00:12
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
…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
@valco1994 valco1994 force-pushed the authenticity-verification branch 2 times, most recently from 0117588 to 989125c Compare January 27, 2026 14:20
…o:embed to make it available in the source code
@valco1994 valco1994 force-pushed the authenticity-verification branch from 989125c to bb6e9ad Compare January 27, 2026 14:25
@valco1994
Copy link
Contributor Author

@philwo, @meteorcloudy, @fweikert, please, take a look at it.

@meteorcloudy meteorcloudy requested a review from fweikert January 28, 2026 16:27
@valco1994
Copy link
Contributor Author

It would be ok, if this PR is reviewed deeply after #192, because it's initially based on #192.
But among other things, it introduces a possibility to skip authenticity verification and to use an alternative verification key. I think that these features are critically important, and should be supported before releasing the authenticity verification feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants