Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

fix(release): fail closed on a pinned key, fix verify snippet, keep old pin on rotation

Claudec91918c3e92e
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e6406d89..baca7b9c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -76,6 +76,10 @@ jobs:
run: |
set -euo pipefail
if [ -z "$BEACON_LINUX_SIGNING_KEY" ]; then
+ if [ -n "$(xargs < cli/beacon/internal/endpoint/selfupdate/release-key.fingerprint)" ]; then
+ echo "::error title=Linux signing key missing::release-key.fingerprint is pinned but BEACON_LINUX_SIGNING_KEY is not configured."
+ exit 1
+ fi
echo "::notice title=Linux signing skipped::BEACON_LINUX_SIGNING_KEY is not configured, so the .deb and .rpm are unsigned."
exit 0
fi
@@ -489,7 +493,13 @@ jobs:
BEACON_LINUX_SIGNING_KEY_PASSPHRASE: ${{ secrets.BEACON_LINUX_SIGNING_KEY_PASSPHRASE }}
run: |
set -euo pipefail
+ # The pin is what the goreleaser before-hook stamped into this release's install.sh.
+ pinned="$(sed -n 's/^release_key_fingerprints=//p' install.sh | tr -d '\r' | tr a-f A-F)"
if [ -z "$BEACON_LINUX_SIGNING_KEY" ]; then
+ if [ -n "$pinned" ]; then
+ echo "::error title=Linux signing key missing::this release pins ${pinned} but BEACON_LINUX_SIGNING_KEY is not configured."
+ exit 1
+ fi
echo "::notice title=Linux signing skipped::BEACON_LINUX_SIGNING_KEY is not configured, so checksums.txt is unsigned."
exit 0
fi
@@ -497,6 +507,10 @@ jobs:
mkdir -m 0700 "$GNUPGHOME"
printf '%s\n' "$BEACON_LINUX_SIGNING_KEY" | gpg --batch --import
fpr="$(gpg --batch --with-colons --list-secret-keys | awk -F: '$1 == "fpr" { print $10; exit }')"
+ if [ -n "$pinned" ] && ! printf '%s\n' "$pinned" | tr , '\n' | grep -qxF "$(printf '%s' "$fpr" | tr a-f A-F)"; then
+ echo "::error title=Signing key not pinned::BEACON_LINUX_SIGNING_KEY is ${fpr}, which release-key.fingerprint (${pinned}) does not list."
+ exit 1
+ fi
printf '%s' "$BEACON_LINUX_SIGNING_KEY_PASSPHRASE" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 \
--local-user "$fpr" --output checksums.txt.sig --detach-sign checksums.txt
gpg --batch --export "$fpr" > beacon-release-key.gpg
diff --git a/CLAUDE.md b/CLAUDE.md
index 54485c94..ac52194f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -319,8 +319,12 @@ released `install.sh`, so pinning is a change to that file alone. Empty means
checksum-only, as before. Once set, `install.sh` and `beacon endpoint update
--apply` on Linux refuse a package unless a `checksums.txt` signed by a pinned
key lists it. Publish the fingerprint in `docs/platforms/linux.mdx#release-signing`.
-To rotate, add the new fingerprint in a release still signed by the old key,
-then switch the secret and drop the old fingerprint in the next release.
+To rotate, add the new fingerprint in a release still signed by the old key. Then
+sign `checksums.txt` with both keys and ship both in `beacon-release-key.gpg` (the
+`finalize` step signs with one key today, so extend it first; `gpgv` and
+`validSigFrom` accept either pinned key), and keep the old fingerprint pinned until
+the fleet has moved. A host that skipped the transition pins only the old key, cannot
+verify a new-key-only release, and must reinstall.
Do not pin a fingerprint until the release publishes only after `finalize` has signed
`checksums.txt` (for example a draft release published at the end, with the Homebrew
tap push deferred): today `finalize` uploads the `.sig` after the release is public, so
diff --git a/cli/beacon/internal/endpoint/selfupdate/apply.go b/cli/beacon/internal/endpoint/selfupdate/apply.go
index fc605094..540e4e7f 100644
--- a/cli/beacon/internal/endpoint/selfupdate/apply.go
+++ b/cli/beacon/internal/endpoint/selfupdate/apply.go
@@ -226,7 +226,7 @@ func (a *Applier) installPackage(ctx context.Context, pkg Package, result ApplyR
// path rather than a downgrade. Once a release key is pinned, Linux also requires the
// package in a checksums.txt signed by Beacon's release key.
switch {
- case runtime.GOOS == "linux" && len(releaseKeyFingerprints) > 0:
+ case runtime.GOOS == "linux" && len(releaseKeyFingerprints) > 0 && !a.AllowInsecureTest:
result.Verification = "sha256+gpg"
if err := a.verifyReleaseSignature(ctx, pkg.URL, pkgPath); err != nil {
a.emit(false, result, err.Error())
diff --git a/docs/platforms/linux.mdx b/docs/platforms/linux.mdx
index 6394f017..a12e0349 100644
--- a/docs/platforms/linux.mdx
+++ b/docs/platforms/linux.mdx
@@ -271,13 +271,14 @@ The installer and the self-updater pin that fingerprint. They take the key from
```bash title="Verify a signed release"
FPR="<release key fingerprint>"
-curl -fsSLO "${BASE}/checksums.txt.sig" && curl -fsSLO "${BASE}/beacon-release-key.gpg" && curl -fsSLO "${BASE}/beacon-release-key.asc"
-test "$(gpg --show-keys --with-colons beacon-release-key.asc | awk -F: '$1 == "fpr" { print $10; exit }')" = "$FPR" && \
- gpgv --keyring "$PWD/beacon-release-key.gpg" checksums.txt.sig checksums.txt
-sudo rpm --import beacon-release-key.asc && rpm -K "${PKG}" # .rpm
+curl -fsSLO "${BASE}/checksums.txt.sig" && curl -fsSLO "${BASE}/beacon-release-key.gpg"
+gpg --show-keys --with-colons beacon-release-key.gpg | awk -F: -v fpr="$FPR" '$1 == "fpr" && toupper($10) == toupper(fpr) { ok = 1 } END { exit !ok }' && \
+ gpgv --keyring "$PWD/beacon-release-key.gpg" --status-fd 1 checksums.txt.sig checksums.txt 2>/dev/null | \
+ awk -v fpr="$FPR" '$1 == "[GNUPG:]" && $2 == "VALIDSIG" && toupper($NF) == toupper(fpr) { ok = 1 } END { exit !ok }' && echo "signed by $FPR"
+sudo rpm --import beacon-release-key.gpg && rpm -K "${PKG}" # .rpm
```
-Rotation: one release pins both the old and the new fingerprint and is still signed by the old key; the release after it is signed by the new key and drops the old pin. Installed agents therefore trust the new key before they need it. The new fingerprint is published here and in the release notes of the release that first pins it.
+Rotation: one release pins both the old and the new fingerprint and is still signed by the old key. Later releases are signed by both keys, with both in the key file, and keep the old fingerprint pinned until the installed fleet has moved to a build that pins the new one, because a host that still pins only the old key refuses a release signed only by the new key. Such a host has to reinstall with the current installer. The new fingerprint is published here and in the release notes of the release that first pins it.
Upgrading the package keeps your configuration and your collected log.