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
apt repository: attest every package and sign with both keys in a rotation
Claudef73e891b7982
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 84a2481a..f0853e68 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -9,12 +9,12 @@ name: Release# 3. windows-package — (after goreleaser) builds the Windows MSI from the archive# goreleaser just published, installs it to prove it works, and# attaches it. Unsigned for now, so it needs no secrets.-# 4. apt-repository — (after goreleaser) adds the released .deb files to the signed apt-# repository in object storage. Skipped until its APT_* secrets and-# variables are configured.-# 5. finalize — (after goreleaser, package and windows-package) adds the .pkg, .msi and+# 4. finalize — (after goreleaser, package and windows-package) adds the .pkg, .msi and# install.sh to checksums.txt and records a GitHub build-provenance# attestation for every file checksums.txt lists.+# 5. apt-repository — (after finalize) adds the released .deb files, each checked against its+# attestation, to the signed apt repository in object storage. Skipped+# until its APT_* secrets and variables are configured.## 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@@ -433,7 +433,8 @@ jobs:# a version that is already published. An older index this key once signed does pass that check;# the backfill below re-adds any recent release such a rollback dropped.#- # The packages are the bytes goreleaser published, checked against checksums.txt, not a rebuild.+ # The packages are the bytes goreleaser published, checked against the build-provenance attestation+ # finalize recorded for them, not a rebuild.## Skipped with a notice until every APT_* secret and variable exists, and for prerelease tags,# which do not belong in `stable`. Serialized so two tags cannot race on the index. GitHub@@ -441,8 +442,14 @@ jobs:# each run therefore also adds recent releases the index is missing (see "Fetch the released# .deb files"), and a release whose run was cancelled is published by the next one.apt-repository:- needs: goreleaser+ # After finalize, which records the build-provenance attestations every package is checked+ # against before it is signed into the index.+ needs: [goreleaser, finalize]+ if: ${{ !cancelled() && needs.finalize.result == 'success' }}runs-on: ubuntu-latest+ permissions:+ contents: read+ attestations: readenvironment: releasetimeout-minutes: 30concurrency:@@ -510,13 +517,18 @@ jobs:aws --version# The keyring users install is built from the committed public key file, never exported from- # the secret, and build-apt-repo.sh fails unless the secret's key signs for it. Rotating the- # key is therefore a reviewed commit, not a secret edit: add the new public key to- # beacon-archive-keyring.asc beside the old one, replace the secret, and remove the old key- # once a release signed by the new one is published. The published index is checked against- # every key in the file, so the first release after a rotation still accepts the index the- # old key signed.- - name: Import the signing key+ # the secret, and build-apt-repo.sh fails unless every key in the secret is in that file and+ # signed. Rotating the key is therefore a reviewed commit, not only a secret edit, in two steps:+ # 1. Commit the new public key beside the old one in beacon-archive-keyring.asc and put both+ # secret keys in APT_GPG_PRIVATE_KEY. Every release then signs the index with both, so+ # hosts that trust only the old key keep updating, and the published keyring carries+ # both keys for hosts to fetch again.+ # 2. Once hosts have the new keyring, remove the old key from the file and the secret.+ # A host that never fetched it fails `apt update` from then on: hosts install the+ # keyring once and the package does not ship it, so step 1 must last long enough.+ # The published index is checked against every key in the file, and a signature from a key+ # no longer in it is ignored, so each step accepts the index the previous one signed.+ - name: Import the signing keysif: steps.gate.outputs.publish == 'true'id: keyrun: |@@ -526,19 +538,22 @@ jobs:mkdir -m 0700 "$GNUPGHOME"echo "GNUPGHOME=$GNUPGHOME" >> "$GITHUB_ENV"printf '%s\n' "$APT_GPG_PRIVATE_KEY" | gpg --batch --quiet --import- # Sign with the key the secret holds, not the first one in the committed file, which- # during a rotation is the retired key.- sec="$(gpg --batch --with-colons --list-secret-keys | awk -F: '$1 == "sec" { n++; want = 1; next } want && $1 == "fpr" { print $10; want = 0 } END { if (n != 1) exit 1 }')" \- || { echo "APT_GPG_PRIVATE_KEY must hold exactly one secret key" >&2; exit 1; }+ # Sign with every key the secret holds, not the keys in the committed file: during step 2+ # of a rotation the file may still be catching up, and a key in the file without its+ # secret cannot sign.+ secret="$(gpg --batch --with-colons --list-secret-keys | awk -F: '$1 == "sec" { want = 1; next } want && $1 == "fpr" { print $10; want = 0 }')"+ [ -n "$secret" ] || { echo "APT_GPG_PRIVATE_KEY holds no secret key" >&2; exit 1; }committed="$(gpg --batch --with-colons --show-keys "$KEYRING_ASC" | awk -F: '$1 == "pub" { want = 1; next } want && $1 == "fpr" { print $10; want = 0 }')"[ -n "$committed" ] || { echo "no key in $KEYRING_ASC" >&2; exit 1; }- printf '%s\n' "$committed" | grep -qxF "$sec" \- || { echo "the key in APT_GPG_PRIVATE_KEY ($sec) is not in $KEYRING_ASC; commit its public key first" >&2; exit 1; }+ for fpr in $secret; do+ printf '%s\n' "$committed" | grep -qxF "$fpr" \+ || { echo "the key $fpr in APT_GPG_PRIVATE_KEY is not in $KEYRING_ASC; commit its public key first" >&2; exit 1; }+ donegpg --batch --quiet --import "$KEYRING_ASC"# shellcheck disable=SC2086 # one fingerprint per wordgpg --batch --export $committed > "$RUNNER_TEMP/beacon-archive-keyring.gpg"- echo "fingerprint=$sec" >> "$GITHUB_OUTPUT"- echo "signing with $sec; trusted keys: $(printf '%s\n' "$committed" | paste -sd' ')"+ echo "fingerprints=$(printf '%s\n' "$secret" | paste -sd' ')" >> "$GITHUB_OUTPUT"+ echo "signing with: $(printf '%s\n' "$secret" | paste -sd' '); trusted keys: $(printf '%s\n' "$committed" | paste -sd' ')"# Only the signed index is read back. A missing InRelease is the first publish (or a first# publish that stopped before writing it, which this resumes); any other error fails the job@@ -603,25 +618,44 @@ jobs:}END { exit !found }' "$EXISTING/main/binary-$2/Packages"}- # fetch TAG ARCH... -- downloads TAG's .debs for ARCH into dist/apt-debs/TAG and checks- # them against that release's checksums.txt.+ # fetch TAG MODE ARCH... -- downloads TAG's .debs for ARCH into dist/apt-debs/TAG. Each must+ # carry a build-provenance attestation that this repository's release workflow made at+ # refs/tags/TAG (finalize records them): not checksums.txt, which anyone who can edit a+ # release can replace together with the .deb. Its control fields must also name beacon,+ # TAG's version and ARCH, since build-apt-repo.sh indexes a package by what it says+ # about itself. This tag's packages (MODE required) must pass; a backfilled release whose+ # package has no such attestation (one from before attestations, or a replaced asset) is+ # left out with a warning. A package that is attested but misnamed fails the job.fetch() {- tag="$1" version="${1#v}" dir="dist/apt-debs/$1"- shift+ tag="$1" mode="$2" version="${1#v}" dir="dist/apt-debs/$1"+ shift 2mkdir -p "$dir"for arch in "$@"; do- gh release download "$tag" --repo "$REPO" --dir "$dir" --pattern "beacon_${version}_linux_${arch}.deb"- done- gh release download "$tag" --repo "$REPO" --dir "$dir" --pattern checksums.txt- # Every .deb must be listed; --ignore-missing alone would pass an unlisted one.- for f in "$dir"/beacon_*.deb; do- awk -v name="${f##*/}" '$2 == name { found = 1 } END { exit !found }' "$dir/checksums.txt" \- || { echo "${f##*/} is not in $tag's checksums.txt" >&2; exit 1; }+ name="beacon_${version}_linux_${arch}.deb"+ deb="$dir/$name"+ gh release download "$tag" --repo "$REPO" --dir "$dir" --pattern "$name"+ if ! gh attestation verify "$deb" --repo "$REPO" \+ --signer-workflow "$REPO/.github/workflows/release.yml" --source-ref "refs/tags/$tag" \+ --deny-self-hosted-runners > "$RUNNER_TEMP/attestation.log" 2>&1; then+ cat "$RUNNER_TEMP/attestation.log" >&2+ if [ "$mode" = required ]; then+ echo "$name has no build-provenance attestation from $REPO's release workflow at $tag" >&2+ exit 1+ fi+ echo "::warning title=apt repository::$name has no build-provenance attestation from the release workflow at $tag; it is not published"+ rm -f "$deb"+ continue+ fi+ for field in "Package=beacon" "Version=$version" "Architecture=$arch"; do+ got="$(dpkg-deb -f "$deb" "${field%%=*}")"+ [ "$got" = "${field#*=}" ] \+ || { echo "$name from $tag declares ${field%%=*} '$got', expected '${field#*=}'" >&2; exit 1; }+ donedone- (cd "$dir" && sha256sum --check --ignore-missing --strict checksums.txt)+ rmdir "$dir" 2>/dev/null || true}# This tag's packages are always fetched, so a rerun checks them against the index again.- fetch "$TAG" amd64 arm64+ fetch "$TAG" required amd64 arm64tags="$(gh release list --repo "$REPO" --exclude-drafts --exclude-pre-releases --limit 200 \--json tagName --jq '.[].tagName' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true)"# Releases up to this one only: a newer tag's assets may still be uploading.@@ -639,17 +673,20 @@ jobs:[ -n "$missing" ] || continueecho "::notice::$tag is missing from the apt repository for$missing; adding it"# shellcheck disable=SC2086 # one architecture per word- fetch "$tag" $missing+ fetch "$tag" optional $missingdone- name: Build and sign the repository updateif: steps.gate.outputs.publish == 'true'env:- FINGERPRINT: ${{ steps.key.outputs.fingerprint }}+ FINGERPRINTS: ${{ steps.key.outputs.fingerprints }}EXISTING: ${{ steps.existing.outputs.dir }}run: |set -euo pipefail- set -- --out dist/apt-repo --keyring "$RUNNER_TEMP/beacon-archive-keyring.gpg" --signing-key "$FINGERPRINT"+ set -- --out dist/apt-repo --keyring "$RUNNER_TEMP/beacon-archive-keyring.gpg"+ for fpr in $FINGERPRINTS; do+ set -- "$@" --signing-key "$fpr"+ doneif [ -n "$EXISTING" ]; thenset -- "$@" --existing "$EXISTING"fidiff --git a/CLAUDE.md b/CLAUDE.mdindex 208d2454..a1766c98 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -287,17 +287,31 @@ A pushed `v*` tag runs the full release end-to-end viaworks, and attaches the `.msi` and its `.sha256`. Deliberately **not** in the`release` environment: that environment gates signing secrets, and the MSI isunsigned, so this job has none to gate.-4. `apt-repository` (ubuntu, `needs: goreleaser`, `environment: release`) adds the- released `.deb` files, checked against `checksums.txt`, to the signed apt repository+4. `finalize` (ubuntu, `needs` goreleaser, package and windows-package, runs whenever `goreleaser` succeeded)+ appends the `.pkg`, `.msi` and `install.sh` to `checksums.txt` from the released bytes and+ records a GitHub build-provenance attestation (Sigstore, keyless, through the+ workflow's OIDC token) for every file `checksums.txt` lists. It needs+ `id-token: write` and `attestations: write` and no `release`-environment secrets.+5. `apt-repository` (ubuntu, `needs: [goreleaser, finalize]`, `environment: release`,+ `contents: read`/`attestations: read`) adds the released `.deb` files to the signed apt+ repository(`deb <APT_REPO_URL> stable main`) in an S3-compatible bucket, because 85-90 MB packagesoutgrow a git-backed Pages repo. `packaging/linux/apt/build-apt-repo.sh` reads back only thepublished index (InRelease, and each `Packages` through the by-hash path it names, so apublish that stopped partway reads consistently and resumes), verifies it against thecommitted public keys `packaging/linux/apt/beacon-archive-keyring.asc` before re-signing (soan edited index is never re-signed), refuses to replace a published version, and fails unless- the secret's key is one of the committed ones. Rotating the key is a reviewed commit: add the- new public key beside the old, replace the secret (the job signs with the key the secret- holds), and drop the old key after one release. First publish is decided by a `head-object` on+ every key in the secret is a committed one and signed. Every `.deb` (this tag's and each+ backfilled one) must pass `gh attestation verify` against finalize's attestation from+ `release.yml` at `refs/tags/<tag>`, never the release's replaceable `checksums.txt`, and its+ control fields must name `beacon`, the tag's version and the architecture; this tag's must+ pass, and a backfilled one without an attestation is left out with a warning. Rotating the+ key is a reviewed commit in two steps: commit the new public key beside the old and put both+ secret keys in `APT_GPG_PRIVATE_KEY`, so every release is signed by both and hosts that trust+ only the old key keep updating while they fetch the new keyring; then remove the old key from+ the file and the secret. Hosts install the keyring once and the package does not ship it, so+ one that never refetches it breaks at step two. A published index counts as signed with at+ least one good signature from a committed key and no bad one. First publish is decided by a `head-object` on`dists/stable/InRelease` (404 only; any other error fails). Each run adds its own tag plus anyof the last `APT_BACKFILL_RELEASES` (10) stable releases up to it that the index lacks, becausethe `apt-repository` concurrency group cancels a pending job when a third arrives; that also@@ -308,11 +322,6 @@ A pushed `v*` tag runs the full release end-to-end viaCI's `apt-repository` job runs `test-apt-repo.sh`.Upload order is pool, index, then `Release.gpg`/`Release`/`InRelease` with `Acquire-By-Hash`.Skipped with a notice until every `APT_*` setting exists, and for prerelease (`-`) tags.-5. `finalize` (ubuntu, `needs` goreleaser, package and windows-package, runs whenever `goreleaser` succeeded)- appends the `.pkg`, `.msi` and `install.sh` to `checksums.txt` from the released bytes and- records a GitHub build-provenance attestation (Sigstore, keyless, through the- workflow's OIDC token) for every file `checksums.txt` lists. It needs- `id-token: write` and `attestations: write` and no `release`-environment secrets.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@@ -325,7 +334,7 @@ Required `release`-environment secrets: `HOMEBREW_TAP_TOKEN`,`DEVELOPER_ID_INSTALLER_CERT_P12`, `DEVELOPER_ID_INSTALLER_CERT_PASSWORD`,`NOTARY_API_KEY_P8`, `NOTARY_API_KEY_ID`, `NOTARY_API_ISSUER`; plus Variables`DEVELOPER_ID_APP_IDENTITY`, `DEVELOPER_ID_INSTALLER_IDENTITY`, `APPLE_TEAM_ID`.-The apt repository adds secrets `APT_GPG_PRIVATE_KEY` (armored, no passphrase),+The apt repository adds secrets `APT_GPG_PRIVATE_KEY` (armored, no passphrase; both keys during a rotation),`APT_S3_ACCESS_KEY_ID`, `APT_S3_SECRET_ACCESS_KEY` and Variables `APT_S3_BUCKET`,`APT_REPO_URL` (https), plus optional `APT_S3_ENDPOINT` (R2/GCS) and `APT_S3_REGION`.Keep one-time Apple-side onboarding steps out of the repo and share them withdiff --git a/packaging/linux/apt/build-apt-repo.sh b/packaging/linux/apt/build-apt-repo.shindex db61df7d..0a570afb 100755--- a/packaging/linux/apt/build-apt-repo.sh+++ b/packaging/linux/apt/build-apt-repo.sh@@ -2,16 +2,22 @@# Builds the next state of Beacon's signed apt repository from the .deb files of one release.## packaging/linux/apt/build-apt-repo.sh --out DIR --keyring FILE --signing-key FPR \-# [--existing DIR] DEB...+# [--signing-key FPR...] [--existing DIR] DEB...## The published repository lives in object storage and keeps every version's .deb under pool/, so# this script never downloads the pool. It takes the published index instead (--existing: a copy# of dists/stable holding InRelease and main/binary-<arch>/Packages, the latter fetched through the# by-hash path InRelease names so a publish that stopped partway still reads consistently), checks# that index against the committed public keys (--keyring, a binary keyring that may hold the old-# and new key during a rotation), adds the new packages to it, and signs the result with-# --signing-key, which must be one of those keys. Without --existing it starts an empty repository, which is right-# only for the very first publish.+# and new key during a rotation), adds the new packages to it, and signs the result with every+# --signing-key, each of which must be one of those keys. Without --existing it starts an empty+# repository, which is right only for the very first publish.+#+# During a key rotation the index is signed by the old and the new key at once. apt accepts it when+# any signature comes from a key the client trusts, so hosts that still have only the old keyring+# keep updating while they pick up the new one. A published index therefore counts as signed when+# at least one signature is good from a committed key and none is bad; a signature from a key that+# is no longer committed is ignored, so the old key can later be removed.## Checking the published index first matters because the result is re-signed: a Packages file# altered in the bucket would otherwise come back out carrying a valid signature.@@ -42,13 +48,13 @@ fail() {out=""keyring=""-signing_key=""+signing_keys=""existing=""while [ $# -gt 0 ]; docase "$1" in--out) out="$2"; shift 2 ;;--keyring) keyring="$2"; shift 2 ;;- --signing-key) signing_key="$2"; shift 2 ;;+ --signing-key) signing_keys="$signing_keys $2"; shift 2 ;;--existing) existing="$2"; shift 2 ;;--) shift; break ;;-*) fail "unknown option $1" ;;@@ -57,7 +63,7 @@ while [ $# -gt 0 ]; dodone[ -n "$out" ] || fail "--out is required"[ -n "$keyring" ] || fail "--keyring is required"-[ -n "$signing_key" ] || fail "--signing-key is required"+[ -n "$signing_keys" ] || fail "--signing-key is required"[ $# -gt 0 ] || fail "no .deb files given"[ -f "$keyring" ] || fail "keyring $keyring does not exist"for tool in apt-ftparchive dpkg-deb gpg gpgv sha256sum; do@@ -74,6 +80,23 @@ work="$(mktemp -d)"trap 'rm -rf "$work"' EXIT INT TERMdists="$out/dists/$SUITE"+# good_sigs FILE [DATA] -- verifies a clearsigned FILE, or a detached signature FILE over DATA,+# against the committed keyring and prints the primary fingerprint of each good signature. Fails+# when a signature is bad, expired or revoked, or when none is good. A signature from a key that+# is not in the keyring (NO_PUBKEY) is neither: during a rotation it is the other key's.+good_sigs() {+ gpgv --status-fd 3 --keyring "$keyring" ${GOOD_SIGS_OUTPUT:+--output "$GOOD_SIGS_OUTPUT"} "$@" \+ 3>"$work/gpgv.status" >/dev/null 2>"$work/gpgv.log" || true+ if grep -qE '^\[GNUPG:\] (BADSIG|EXPSIG|EXPKEYSIG|REVKEYSIG) ' "$work/gpgv.status"; then+ cat "$work/gpgv.log" >&2+ return 1+ fi+ awk '$2 == "VALIDSIG" { print $NF; n++ } END { exit n == 0 }' "$work/gpgv.status" || {+ cat "$work/gpgv.log" >&2+ return 1+ }+}+# Prints one "package|version|arch sha256" line per stanza of a Packages file.stanza_keys() {awk 'BEGIN { RS = "" }@@ -96,10 +119,9 @@ for arch in $ARCHES; dodoneif [ -n "$existing" ]; then[ -f "$existing/InRelease" ] || fail "$existing/InRelease does not exist"- gpgv --keyring "$keyring" --output "$work/old-Release" "$existing/InRelease" 2>"$work/gpgv.log" || {- cat "$work/gpgv.log" >&2- fail "the published InRelease is not signed by any committed key"- }+ GOOD_SIGS_OUTPUT="$work/old-Release" good_sigs "$existing/InRelease" >/dev/null \+ || fail "the published InRelease is not signed by any committed key"+ [ -s "$work/old-Release" ] || fail "the published InRelease holds no Release"for arch in $ARCHES; dorel="$COMPONENT/binary-$arch/Packages"# The SHA256 block lists " <hash> <size> <path>"; only that block is read.@@ -225,21 +247,27 @@ for arch in $ARCHES; dodonedone-set -- --batch --yes --local-user "$signing_key"+set -- --batch --yes+for fpr in $signing_keys; do+ set -- "$@" --local-user "$fpr"+doneif [ -n "${APT_GPG_PASSPHRASE_FILE:-}" ]; thenset -- "$@" --pinentry-mode loopback --passphrase-file "$APT_GPG_PASSPHRASE_FILE"figpg "$@" --digest-algo SHA512 --clearsign --output "$dists/InRelease" "$dists/Release"gpg "$@" --digest-algo SHA512 --armor --detach-sign --output "$dists/Release.gpg" "$dists/Release"-# The signing key in the secret must be the key users were told to trust.-gpgv --keyring "$keyring" "$dists/InRelease" 2>"$work/gpgv.log" || {- cat "$work/gpgv.log" >&2- fail "the new InRelease does not verify against $keyring; the signing key is not the committed key"-}-gpgv --keyring "$keyring" "$dists/Release.gpg" "$dists/Release" 2>"$work/gpgv.log" || {- cat "$work/gpgv.log" >&2- fail "the new Release.gpg does not verify against $keyring"-}+# Every signing key in the secret must be a key users were told to trust, and must have signed.+for f in InRelease Release.gpg; do+ if [ "$f" = InRelease ]; then+ good_sigs "$dists/InRelease" > "$work/signed-by" || true+ else+ good_sigs "$dists/Release.gpg" "$dists/Release" > "$work/signed-by" || true+ fi+ for fpr in $signing_keys; do+ grep -qxiF "$fpr" "$work/signed-by" \+ || fail "the new $f carries no good signature from $fpr in $keyring; the signing key is not a committed key"+ done+doneecho "build-apt-repo: staged $(find "$out/pool" -name '*.deb' | wc -l | tr -d ' ') new package(s) in $out"diff --git a/packaging/linux/apt/test-apt-repo.sh b/packaging/linux/apt/test-apt-repo.shindex eee7a1a3..72f6a1a4 100755--- a/packaging/linux/apt/test-apt-repo.sh+++ b/packaging/linux/apt/test-apt-repo.sh@@ -149,7 +149,7 @@ if sh "$BUILD" --out "$work/out7" --keyring "$work/keyring.gpg" --signing-key "$--existing "$work/existing" "$deb_a3" "$deb_b3" 2>"$work/err7"; thenfail "signing with another key was accepted"fi-grep -q 'signing key is not the committed key' "$work/err7" || { cat "$work/err7" >&2; fail "wrong error for the wrong signing key"; }+grep -q 'signing key is not a committed key' "$work/err7" || { cat "$work/err7" >&2; fail "wrong error for the wrong signing key"; }pass "the wrong signing key is refused"# 8. A client that trusts another key refuses the repository.@@ -174,31 +174,42 @@ for v in 1.0.0 1.0.1 1.0.2; dodonepass "a publish that stopped before InRelease is resumed"-# 10. Key rotation: the committed keyring holds the old and the new key and the new key signs.-# The published index the old key signed is still accepted, and clients trusting both or only-# the new key accept the result. Several releases merge in one run (a missed release added-# by the next one).+# 10. Key rotation, step one: the new public key is committed beside the old one and both keys+# sign. The index the old key alone signed is accepted, and a client that still trusts only+# the old key, one that trusts only the new key, and one that trusts both all accept the+# result. Several releases merge in one run (a missed release added by the next one).gpg --batch --export "$fpr" "$other_fpr" > "$work/both-keyring.gpg"existingdeb_a4="$(make_deb 1.0.3 amd64)"deb_b4="$(make_deb 1.0.3 arm64)"deb_a5="$(make_deb 1.0.4 amd64)"deb_b5="$(make_deb 1.0.4 arm64)"-sh "$BUILD" --out "$work/out10" --keyring "$work/both-keyring.gpg" --signing-key "$other_fpr" \+sh "$BUILD" --out "$work/out10" --keyring "$work/both-keyring.gpg" \+ --signing-key "$fpr" --signing-key "$other_fpr" \--existing "$work/existing" "$deb_a4" "$deb_b4" "$deb_a5" "$deb_b5"publish "$work/out10"for v in 1.0.0 1.0.3 1.0.4; dosh "$VERIFY" "file:$work/bucket" "$work/both-keyring.gpg" "$v" >/dev/nulldone-sh "$VERIFY" "file:$work/bucket" "$work/other-keyring.gpg" 1.0.4 >/dev/null-pass "a rotated key re-signs the old key's index, keeping every version"-+sh "$VERIFY" "file:$work/bucket" "$work/keyring.gpg" 1.0.4 >/dev/null \+ || fail "a client that trusts only the old key refused the index during the rotation"+sh "$VERIFY" "file:$work/bucket" "$work/other-keyring.gpg" 1.0.4 >/dev/null \+ || fail "a client that trusts only the new key refused the index during the rotation"+pass "during a rotation both keys sign, so clients trusting either key keep updating"++# 11. Step two: the old key is removed from the keyring and the secret. The index both keys+# signed is still read (the old key's signature is ignored, the new one's is good).existingdeb_a6="$(make_deb 1.0.5 amd64)"deb_b6="$(make_deb 1.0.5 arm64)"sh "$BUILD" --out "$work/out11" --keyring "$work/other-keyring.gpg" --signing-key "$other_fpr" \--existing "$work/existing" "$deb_a6" "$deb_b6"-pass "after a rotation the old key can be removed from the committed keyring"+publish "$work/out11"+sh "$VERIFY" "file:$work/bucket" "$work/other-keyring.gpg" 1.0.5 >/dev/null+if sh "$VERIFY" "file:$work/bucket" "$work/keyring.gpg" 1.0.5 >/dev/null 2>&1; then+ fail "a client trusting only the removed key still accepted the index"+fi+pass "after the rotation the old key is removed and its signature is no longer made"# 12. A staged tree holds only what a run adds, so the pre-publish check verifies the index ("-")# and each staged package's own version and architecture, not every architecture.