The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
release: sign checksums.txt in GoReleaser so a release is never latest unsigned
Claude83f783ae3a54
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 8ae5fed2..d3be82f9 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -2,8 +2,8 @@ name: Release# Full hands-off release on a pushed v* tag:# 1. goreleaser — builds tarballs, publishes the GitHub release + changelog,-# and updates the Homebrew tap. Signs the .deb/.rpm when the-# Linux signing key secret exists.+# and updates the Homebrew tap. Signs the .deb/.rpm and+# checksums.txt when the Linux signing key secret exists.# 2. package — (after goreleaser) builds, signs, notarizes, and staples the# macOS .pkg for both arches and attaches them plus the# package update manifest to the same release.@@ -12,8 +12,8 @@ name: Release# attaches it. Unsigned for now, so it needs no secrets.# 4. finalize — (after all three) adds the .pkg, .msi and install.sh to checksums.txt and# records a GitHub build-provenance attestation for every file-# checksums.txt lists. Signs checksums.txt when the Linux signing-# key secret exists.+# checksums.txt lists. Re-signs the extended checksums.txt when+# the Linux signing key secret exists.## Triggered only by pushed version tags, so outside contributors (whose fork PRs# never receive secrets) cannot run it. All release secrets live in the protected@@ -68,24 +68,45 @@ jobs:- name: Download Vector for the Linux packagesrun: sh packaging/linux/fetch-vector.sh- # nfpm signs the .deb and .rpm when BEACON_LINUX_SIGNING_KEY_FILE names a key, so they ship- # unsigned, as before, until the BEACON_LINUX_SIGNING_KEY secret exists.+ # nfpm signs the .deb and .rpm when BEACON_LINUX_SIGNING_KEY_FILE names a key, and GoReleaser's+ # signs entry signs checksums.txt with the key imported here, so checksums.txt.sig and the public+ # key are attached while GoReleaser's release is still a draft: a pinned install.sh or self-updater+ # never sees this release as latest without them. Unsigned, as before, until the+ # BEACON_LINUX_SIGNING_KEY secret exists.- name: Stage the Linux release signing keyenv:BEACON_LINUX_SIGNING_KEY: ${{ secrets.BEACON_LINUX_SIGNING_KEY }}run: |set -euo pipefail+ pinned="$(xargs < cli/beacon/internal/endpoint/selfupdate/release-key.fingerprint | tr ' a-f' ',A-F')"if [ -z "$BEACON_LINUX_SIGNING_KEY" ]; then- if [ -n "$(xargs < cli/beacon/internal/endpoint/selfupdate/release-key.fingerprint)" ]; then+ if [ -n "$pinned" ]; thenecho "::error title=Linux signing key missing::release-key.fingerprint is pinned but BEACON_LINUX_SIGNING_KEY is not configured."exit 1fi- echo "::notice title=Linux signing skipped::BEACON_LINUX_SIGNING_KEY is not configured, so the .deb and .rpm are unsigned."+ echo "::notice title=Linux signing skipped::BEACON_LINUX_SIGNING_KEY is not configured, so the .deb, .rpm and checksums.txt are unsigned."+ echo "BEACON_GORELEASER_SKIP=--skip=sign" >> "$GITHUB_ENV"exit 0fikey="$RUNNER_TEMP/beacon-linux-signing.asc"(umask 077 && printf '%s\n' "$BEACON_LINUX_SIGNING_KEY" > "$key")- echo "BEACON_LINUX_SIGNING_KEY_FILE=$key" >> "$GITHUB_ENV"+ export GNUPGHOME="$RUNNER_TEMP/gnupg"+ mkdir -m 0700 "$GNUPGHOME"+ gpg --batch --import "$key"+ fpr="$(gpg --batch --with-colons --list-secret-keys | awk -F: '$1 == "fpr" { print toupper($10); exit }')"+ if [ -n "$pinned" ] && ! printf '%s\n' "$pinned" | tr , '\n' | grep -qxF "$fpr"; 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+ # Attached by the release's extra_files only when BEACON_LINUX_SIGNING_KEY_FILE is set.+ mkdir -p cli/beacon/release-key+ gpg --batch --export "$fpr" > cli/beacon/release-key/beacon-release-key.gpg+ gpg --batch --armor --export "$fpr" > cli/beacon/release-key/beacon-release-key.asc+ {+ echo "BEACON_LINUX_SIGNING_KEY_FILE=$key"+ echo "BEACON_LINUX_SIGNING_KEY_FPR=$fpr"+ echo "GNUPGHOME=$GNUPGHOME"+ } >> "$GITHUB_ENV"- name: Check GoReleaser configworking-directory: cli/beacon@@ -117,7 +138,7 @@ jobs:NFPM_PASSPHRASE: ${{ secrets.BEACON_LINUX_SIGNING_KEY_PASSPHRASE }}GORELEASER_CURRENT_TAG: ${{ github.ref_name }}GORELEASER_PREVIOUS_TAG: ${{ steps.tags.outputs.previous }}- run: goreleaser release --clean --parallelism 1+ run: goreleaser release --clean --parallelism 1 ${BEACON_GORELEASER_SKIP:-}package:needs: goreleaser@@ -482,11 +503,12 @@ jobs:sha256sum "$f" >> checksums.txtdonesha256sum --check checksums.txt --ignore-missing- gh release upload "$TAG" checksums.txt --repo "$REPO" --clobber- # Here rather than in goreleaser because the step above rewrites checksums.txt. Inert, like the- # package signing, until the BEACON_LINUX_SIGNING_KEY secret exists.- - name: Sign checksums.txt+ # GoReleaser already signed the checksums.txt it published. The step above extends it, so it is+ # signed again here, before it is uploaded: the new checksums.txt and its .sig go up together,+ # and a failure before that leaves GoReleaser's matching pair in place. Inert, like the package+ # signing, until the BEACON_LINUX_SIGNING_KEY secret exists.+ - name: Sign and upload checksums.txtworking-directory: dist/releaseenv:BEACON_LINUX_SIGNING_KEY: ${{ secrets.BEACON_LINUX_SIGNING_KEY }}@@ -507,6 +529,7 @@ jobs:exit 1fiecho "::notice title=Linux signing skipped::BEACON_LINUX_SIGNING_KEY is not configured, so checksums.txt is unsigned."+ gh release upload "$TAG" checksums.txt --repo "$REPO" --clobberexit 0fiexport GNUPGHOME="$RUNNER_TEMP/gnupg"@@ -519,10 +542,10 @@ jobs:fiprintf '%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- gpg --batch --armor --export "$fpr" > beacon-release-key.asc+ # Check against the public key GoReleaser attached, the one installers download.+ gh release download "$TAG" --repo "$REPO" --pattern beacon-release-key.gpg --clobbergpgv --keyring "$PWD/beacon-release-key.gpg" checksums.txt.sig checksums.txt- gh release upload "$TAG" checksums.txt.sig beacon-release-key.gpg beacon-release-key.asc --repo "$REPO" --clobber+ gh release upload "$TAG" checksums.txt checksums.txt.sig --repo "$REPO" --clobber- name: Download every file checksums.txt listsworking-directory: dist/releasediff --git a/.gitignore b/.gitignoreindex 7d3fb062..9a2c7848 100644--- a/.gitignore+++ b/.gitignore@@ -26,6 +26,7 @@ cli/beacon/beaconcli/beacon/beacon-*cli/beacon/dist/cli/beacon/release-install/+cli/beacon/release-key/cli/beacon/release-rules/dist/diff --git a/CLAUDE.md b/CLAUDE.mdindex ac52194f..5cb27bd7 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -276,7 +276,12 @@ A pushed `v*` tag runs the full release end-to-end via1. `goreleaser` (ubuntu, `environment: release`) builds the collector dists,publishes the GitHub release + changelog and tarballs, and updates theHomebrew tap. When the `BEACON_LINUX_SIGNING_KEY` secret exists, nfpm- signs the `.deb`/`.rpm` with it; without it they ship unsigned.+ signs the `.deb`/`.rpm` with it, and GoReleaser's `signs` entry signs+ `checksums.txt` as `checksums.txt.sig` and attaches the public key+ (`beacon-release-key.{asc,gpg}`, staged by the workflow under+ `cli/beacon/release-key/`). GoReleaser uploads into a draft and publishes+ last, so a pinned installer never sees a latest release without its `.sig`.+ Without the secret the workflow passes `--skip=sign` and they ship unsigned.2. `package` (macOS, `needs: goreleaser`, `environment: release`) builds theApple Silicon `beacon`/`beacon-hooks` package payload plus arch-matchedcollector and Vector binaries for `darwin_arm64`, then signs, notarizes,@@ -294,9 +299,9 @@ A pushed `v*` tag runs the full release end-to-end viaworkflow's OIDC token) for every file `checksums.txt` lists. It needs`id-token: write` and `attestations: write`, and runs in the `release`environment only so that, when `BEACON_LINUX_SIGNING_KEY` exists, it can sign- the final `checksums.txt` as `checksums.txt.sig` and attach the public key as- `beacon-release-key.{asc,gpg}`. Anything else that rewrites `checksums.txt`- must come before that step.+ the extended `checksums.txt` again before uploading it, in one upload with its+ `.sig`; a failure before that leaves GoReleaser's matching pair in place.+ Anything else that rewrites `checksums.txt` must come before that step.Every third-party action in `release.yml`, `release-extension.yml` and`npm-publish-sdk.yml` is pinned to a full commit SHA with the version in a@@ -321,15 +326,11 @@ checksum-only, as before. Once set, `install.sh` and `beacon endpoint updatekey 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. Thensign `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+GoReleaser `signs` entry and the `finalize` step sign with one key today, so extend+both first; `gpgv` and`validSigFrom` accept either pinned key), and keep the old fingerprint pinned untilthe fleet has moved. A host that skipped the transition pins only the old key, cannotverify 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-a pinned `install.sh` and `beacon endpoint update --apply` refuse the release while the-`.sig` is missing.Keep one-time Apple-side onboarding steps out of the repo and share them withthe release maintainer directly. Never use `pull_request_target` or builddiff --git a/cli/beacon/.goreleaser.yaml b/cli/beacon/.goreleaser.yamlindex 22457394..04c1379e 100644--- a/cli/beacon/.goreleaser.yaml+++ b/cli/beacon/.goreleaser.yaml@@ -210,6 +210,30 @@ checksum:name_template: "checksums.txt"algorithm: sha256+# Signs checksums.txt with the Linux release key release.yml imports (GNUPGHOME and+# BEACON_LINUX_SIGNING_KEY_FPR); release.yml passes --skip=sign when no key is configured.+# GoReleaser uploads into a draft and publishes last, so checksums.txt.sig is on the release+# before it becomes latest. Its checksums.txt is rewritten deterministically at publish, so the+# signature still matches; finalize extends the file and signs it again.+signs:+ - id: checksums+ artifacts: checksum+ cmd: gpg+ signature: "${artifact}.sig"+ stdin: '{{ envOrDefault "NFPM_PASSPHRASE" "" }}'+ args:+ - --batch+ - --pinentry-mode+ - loopback+ - --passphrase-fd+ - "0"+ - --local-user+ - '{{ envOrDefault "BEACON_LINUX_SIGNING_KEY_FPR" "" }}'+ - --output+ - "${signature}"+ - --detach-sign+ - "${artifact}"+changelog:sort: ascfilters:@@ -303,6 +327,8 @@ release:- glob: ./release-rules/threat-rules.tar.gz# The Linux one-line installer, served from releases/latest/download/install.sh.- glob: ./release-install/install.sh+ # The Linux release public key, staged by release.yml only when it signs the release.+ - glob: '{{ if isEnvSet "BEACON_LINUX_SIGNING_KEY_FILE" }}./release-key/beacon-release-key.*{{ end }}'footer: |## Installationdiff --git a/docs/platforms/linux.mdx b/docs/platforms/linux.mdxindex d6ed891c..36223d01 100644--- a/docs/platforms/linux.mdx+++ b/docs/platforms/linux.mdx@@ -263,7 +263,7 @@ sudo beacon endpoint update --apply## Release signing-Signing is wired into the release but not yet active: Beacon has no Linux release key yet, so current `.deb`, `.rpm` and `checksums.txt` files are unsigned, and the installer and `beacon endpoint update` check checksums only. This section applies once a release publishes the key. Do not pin the fingerprint until the release flow publishes only after `finalize` has signed `checksums.txt` (for example a draft release published at the end, with the Homebrew tap push deferred); until then a pinned installer and `beacon endpoint update --apply` refuse a release whose `.sig` is not yet attached.+Signing is wired into the release but not yet active: Beacon has no Linux release key yet, so current `.deb`, `.rpm` and `checksums.txt` files are unsigned, and the installer and `beacon endpoint update` check checksums only. This section applies once a release publishes the key. A signed release never becomes the latest release without its signature: GoReleaser signs `checksums.txt` and attaches the signature and the public key before it publishes the release, and when the macOS and Windows packages are added later, `checksums.txt` is signed again before the extended file replaces it.A signed release carries `checksums.txt.sig` (a detached OpenPGP signature over `checksums.txt`) and the public key as `beacon-release-key.asc` and `beacon-release-key.gpg`. The `.rpm` carries an RPM signature and the `.deb` a `_gpgorigin` signature member, both from the same key. Release key fingerprint: _not yet published_.