Skip to content

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

apt repository: trust only packages built from this release's history

Clauded99f79407c3b
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f0853e68..101fa01d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -505,8 +505,12 @@ jobs:
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
echo "publish=true" >> "$GITHUB_OUTPUT"
+ # Full history and tags: every package is trusted only when its tag's commit is an ancestor
+ # of this run's commit (see "Fetch the released .deb files").
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: steps.gate.outputs.publish == 'true'
+ with:
+ fetch-depth: 0
- name: Install apt repository tools
if: steps.gate.outputs.publish == 'true'
@@ -626,9 +630,26 @@ jobs:
# 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.
+ #
+ # The workflow path and ref alone are not enough: anyone who can push a v* tag can run
+ # their own release.yml at that tag (finalize is outside the release environment) and so
+ # mint a matching attestation. So TAG's commit must be an ancestor of this run's commit,
+ # the history this release was built from, and the attestation must name that commit as
+ # both its source and its signer workflow's commit. A tag on a side commit, or one moved
+ # since its package was attested, is not trusted. This run's own commit is the trust
+ # root, as it already is for everything else this job signs.
fetch() {
tag="$1" mode="$2" version="${1#v}" dir="dist/apt-debs/$1"
shift 2
+ if ! commit="$(git rev-parse --verify --quiet "refs/tags/$tag^{commit}")" \
+ || ! git merge-base --is-ancestor "$commit" "$GITHUB_SHA"; then
+ if [ "$mode" = required ]; then
+ echo "$tag does not resolve to a commit in the history of $GITHUB_SHA" >&2
+ exit 1
+ fi
+ echo "::warning title=apt repository::$tag is not in the history of this release ($GITHUB_SHA); its packages are not published"
+ return 0
+ fi
mkdir -p "$dir"
for arch in "$@"; do
name="beacon_${version}_linux_${arch}.deb"
@@ -636,13 +657,14 @@ jobs:
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" \
+ --source-digest "$commit" --signer-digest "$commit" \
--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
+ echo "$name has no build-provenance attestation from $REPO's release workflow at $tag ($commit)" >&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"
+ echo "::warning title=apt repository::$name has no build-provenance attestation from the release workflow at $tag ($commit); it is not published"
rm -f "$deb"
continue
fi
diff --git a/CLAUDE.md b/CLAUDE.md
index a1766c98..c963bcb3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -303,9 +303,13 @@ A pushed `v*` tag runs the full release end-to-end via
an edited index is never re-signed), refuses to replace a published version, and fails unless
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
+ `release.yml` at `refs/tags/<tag>`, never the release's replaceable `checksums.txt`, pinned
+ (`--source-digest`/`--signer-digest`) to the tag's commit, which must be an ancestor of this
+ run's commit: anyone who can push a `v*` tag can run their own `release.yml` and mint an
+ attestation for that path and ref, so only packages built from this release's history are
+ trusted (the checkout uses `fetch-depth: 0` for the check). Its control fields must name
+ `beacon`, the tag's version and the architecture; this tag's must pass, and a backfilled one
+ that fails (no attestation, or a tag outside the history) 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