feat(release): sign checksums and publish an SBOM
ci / image (pull_request) Successful in 4m1s
ci / build (pull_request) Successful in 8m59s
ci / lint (pull_request) Successful in 10m34s
ci / test (pull_request) Successful in 12m29s

Releases carry SHA256SUMS signed in the minisign format (prehashed
Ed25519, the release tag as trusted comment) and an SPDX SBOM of the Go
modules and the npm packages the frontend build bundles. internal/signing
signs and verifies; the release keys are committed in release.pub and
compiled in, so the self-updating agents can check their downloads.
Without the RELEASE_SIGNING_KEY secret a release is published unsigned
with a warning.

Closes #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-23 18:20:05 +01:00
1 parent d2d6bf9f44
commit b1ca8eb19f
9 files changed
+676 -5

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
package signing
import (
"bytes"
"errors"
"strings"
"testing"
)
func TestSignVerify(t *testing.T) {
k, err := GenerateKey()
if err != nil {
t.Fatal(err)
}
pub := k.Public()
msg := []byte("abc uptimesebi_1.0.0_linux_amd64.tar.gz\n")
sig, err := Sign(k, msg, "v1.0.0")
if err != nil {
t.Fatal(err)
}
if got, err := Verify([]PublicKey{pub}, msg, sig); err != nil || got != "v1.0.0" {
t.Fatalf("Verify = %q, %v", got, err)
}
other, _ := GenerateKey()
if _, err := Verify([]PublicKey{other.Public()}, msg, sig); !errors.Is(err, ErrUnknownKey) {
t.Errorf("unknown key: %v", err)
}
if _, err := Verify([]PublicKey{other.Public(), pub}, msg, sig); err != nil {
t.Errorf("rotated key list: %v", err)
}
if _, err := Verify([]PublicKey{pub}, append(msg, 'x'), sig); !errors.Is(err, ErrSignature) {
t.Errorf("changed file: %v", err)
}
forged := bytes.Replace(sig, []byte("trusted comment: v1.0.0"), []byte("trusted comment: v9.0.0"), 1)
if _, err := Verify([]PublicKey{pub}, msg, forged); !errors.Is(err, ErrSignature) {
t.Errorf("changed trusted comment: %v", err)
}
if _, err := Sign(k, msg, "a\nb"); err == nil {
t.Error("multi-line trusted comment accepted")
}
}
func TestEncoding(t *testing.T) {
k, _ := GenerateKey()
back, err := ParsePrivateKey(k.String())
if err != nil || back.ID != k.ID || !back.Key.Equal(k.Key) {
t.Fatalf("private key round trip: %v", err)
}
keys, err := ParsePublicKeys("# comment\nuntrusted comment: minisign public key\n" + k.Public().String() + "\n\n")
if err != nil || len(keys) != 1 || keys[0].ID != k.ID || !keys[0].Key.Equal(k.Public().Key) {
t.Fatalf("public keys = %v, %v", keys, err)
}
if !strings.HasPrefix(k.Public().String(), "RW") {
t.Errorf("public key %s does not look like minisign's", k.Public())
}
if _, err := ParsePublicKey("RWQ" + strings.Repeat("A", 10)); err == nil {
t.Error("short key accepted")
}
}
func TestReleaseKeys(t *testing.T) {
if len(ReleaseKeys()) == 0 {
t.Error("no release key")
}
}