Use the official pub key to always verify binary (#16857)

This commit is contained in:
Aditya Manthramurthy 2023-03-20 13:16:18 -07:00 committed by GitHub
parent b3c54ec81e
commit 05444a0f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -518,6 +518,11 @@ func downloadBinary(u *url.URL, mode string) (readerReturn []byte, err error) {
return binaryFile, nil
}
const (
// Update this whenever the official minisign pubkey is rotated.
defaultMinisignPubkey = "RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav"
)
func verifyBinary(u *url.URL, sha256Sum []byte, releaseInfo string, mode string, reader []byte) (err error) {
if !atomic.CompareAndSwapUint32(&updateInProgress, 0, 1) {
return errors.New("update already in progress")
@ -538,7 +543,7 @@ func verifyBinary(u *url.URL, sha256Sum []byte, releaseInfo string, mode string,
}
}
minisignPubkey := env.Get(envMinisignPubKey, "")
minisignPubkey := env.Get(envMinisignPubKey, defaultMinisignPubkey)
if minisignPubkey != "" {
v := selfupdate.NewVerifier()
u.Path = path.Dir(u.Path) + slashSeparator + releaseInfo + ".minisig"