Repository navigation
fix(publish): each digest is signed and attested once; an unchanged digest is verified against the workflow, not the commit (#1378) - #1474
Merged
Conversation
…igest is verified against the workflow, not the commit (#1378) Every publish signed and attested every digest its commit's tags resolved to, and verified each attestation with --source-digest <this commit>. That is right only while every commit produces new digests. Once an unchanged image keeps its digest (the build side of #1378), the same digest would get one more signature and one more attestation per commit, and the verification would depend on gh's default of 30 fetched attestations. - scripts/publish-sign.sh: an artifact is signed only when the manifest and, for an image, every child manifest do not already verify under this workflow's identity. A question that goes unanswered is answered by signing. - scripts/publish-provenance.sh: only a digest with no provenance that verifies as this workflow is handed to actions/attest; an attestation lookup that goes unanswered fails the step; the attest step is skipped when nothing is new. Every digest is verified afterwards: a new one against this commit, an unchanged one against the signer workflow alone. Every call passes --limit 1000. A `summary` mode writes the run summary: artifact, digest, new or unchanged, the commit the provenance names, tag. - publish.yaml runs the two scripts in place of its inline loops. - docs: how to get from a digest to the commit that built it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🔵 Needs a closer look
It changes production release signing and attestation across external services without end-to-end write-path validation.
0 open findings
What changed in this PR
This PR makes release signing and provenance idempotent for unchanged artifact digests and adds publish-run reporting.
Changes:
- Signs and attests only artifacts lacking valid existing records.
- Verifies new and unchanged provenance with appropriate commit constraints.
- Adds hermetic tests, documentation, and run summaries.
| File | Description |
|---|---|
.github/workflows/publish.yaml |
Integrates idempotent signing, provenance, and summaries. |
scripts/publish-sign.sh |
Detects and signs unsigned artifacts. |
scripts/publish-provenance.sh |
Selects, verifies, and summarizes provenance. |
scripts/published-chart-refs.sh |
Optionally emits chart tags with references. |
scripts/publish_sign_test.sh |
Tests signing behavior and failures. |
scripts/publish_provenance_test.sh |
Tests provenance and workflow wiring. |
scripts/published_chart_refs_test.sh |
Tests tagged chart output. |
scripts/BUILD.bazel |
Registers the new tests. |
docs/verifying-releases.md |
Documents digest-to-commit verification. |
docs/runbook.md |
Documents publishing operations. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The publish side of #1378, and the first PR of its sequence: it merges before the build stack (#1465, #1466, #1467) and is correct both before and after it. It also carries the sequence's last item, the run summary, because that turned out small.
Part of #1378. Not "Closes": the issue's symptom (every deploy rolls every workload) goes away only when the build stack merges. #1466 says this PR is the one that closes the issue; since this one merges first, the issue needs closing by hand after #1467, or one of those bodies needs the keyword.
Why
Every publish signs and attests every digest its commit's tags resolve to, then verifies each attestation with
--source-digest <this commit>. That is right only while every commit produces new digests. Once an unchanged image keeps its digest:--source-digest <this commit>is the wrong question for a digest an older commit built;gh attestation verifyfetches 30 attestations by default, so the check would start to depend on how many a digest has collected.The decision this implements
The owner's, from #1378: attest only new digests, and sign idempotently.
What
Signing:
scripts/publish-sign.sh(the two sign steps). An artifact is "already signed" when the manifest and, for an image, every child manifest of its index verify under this workflow's identity and issuer. Two questions, cheapest first:cosign verifyis spent;//bazel/cosign:verify_image_signatures, the verifier the verify steps already run, children walked.Anything short of "yes, all of it" is signed now: nothing attached, one child unsigned, a signature by another identity, or a question that went unanswered. A duplicate signature is harmless; an unsigned artifact is not. Every reference, signed now or before, still goes to
signed-*.txt, and the unchanged verify steps check every line.Provenance:
scripts/publish-provenance.sh subjects. A digest "has provenance" when both hold:GET /repos/<repo>/attestations/<digest>). Three answers, read from the HTTP status: 200 with a list, 404 (none), anything else. Anything else is retried four times and then fails the step. It is never read as "none" and never as "attested";gh attestation verify --repo --signer-workflow --predicate-type, no--source-digest). If it does not, the digest is attested now, with a warning.Only digests without provenance reach
actions/attest. When there is none, the attest step is skipped (if: steps.provenance.outputs.subjects != '0') and a::notice::says so.Verification:
publish-provenance.sh verify. Every reference is verified, attested now or skipped. A digest this run attested must name this commit (--source-digest). An unchanged one is verified against the repository and the signer workflow only, and the line prints the commit, run and time its attestation names. A skipped digest with nothing verifiable fails the step.--limit. Everygh attestation verifyhere passes--limit 1000, the maximumghaccepts. With this rule a digest has one attestation, so 30 is never reached. The flag is there so the check cannot start failing because of a count, should a digest ever collect more.Charts: confirmed, no special case needed. Every chart manifest is new with every commit: the
X.Y.Z-<sha>version carries the commit, and theappVersionof all four charts is{STABLE_GIT_VERSION}, aether's bareX.Y.Zone included. So all five chart manifests are signed and attested by every publish, through the same rule as the images. The skip is only what a re-run of the same commit meets.Run summary:
publish-provenance.sh summary. One row per artifact: component, digest, new or unchanged, signed now or before, the commit its provenance names, the tag pushed. Above it, "N of 9 image digests are new".Docs:
docs/verifying-releases.mdgets "Which commit built this digest" and a corrected--source-digest/--limitexplanation; the runbook's signing section describes the new behaviour.publish-verify.yamlis not touched, and nothing it calls changed behaviour (published-chart-refs.shgained an optional--tags; its default output is the same).Evidence
Measured, read-only, against the real store and registry with a digest main published (
gh2.102, the pinned cosign 3.1.2):gh attestation verify … --limit 1000 --format jsonpasses, and the JSON fields the script and the doc read hold the commit and the run;--limit 1001is refused;--source-digestfails withexpected SourceRepositoryDigest to be …, got <the commit>;cosign verify -o jsonprints no commit for a cosign 3 bundle ("optional":{});--certificate-github-workflow-shadoes pin it. The doc gives the second.Tests (all hermetic: fake
curl,cosign,bazel,gh):cosign sign --recursivein the old order; 5 of 5 subjects; each verified with--source-digestsubjects=0, empty checksums file, verify green with no commit pinned$GITHUB_OUTPUT. One 502 then an answer passesif:is there, no inlinecosign signor--source-digestis leftRed first:
--tagschecks failed before their code existed (5 and 5);--limit 30, every digest attested, "listed" taken as enough, no retry, newest instead of oldest origin, zero verified passing, theif:removed, inline signing back; and for signing: unknown read as signed, never skip, never sign, no--recursive, referrers taken as enough, a failedcosign signignored, a skipped reference not recorded. One of them shows a redundancy rather than a gap: without the script's own child listing the unsigned child is still signed, because the verifier walks children too; only the reason printed changes.Also green:
make actionlint(12 workflows clean),bazel test //scripts/... //e2e/... //bazel/actionlint:all //bazel/cosign:all(25 of 25), the lint build over//...withfail_on_violation,make format-check,scripts/check-shell-lint.sh(114 scripts covered),scripts/check-registry-config.sh.Not verified
Nothing here ran against the real registry or attestation store with write access, and
publish.yamlonly runs onmain. So the following are unproven until the first publish after merge:idandif:,GH_TOKENon the subjects step, the summary redirect;actions/attestwith the script's checksums file (the format is unchanged from the inline step);actions/attestdoes with an empty checksums file. Read in its source at the pinned commit: an empty file parses to zero subjects without an error of its own. The skip keeps that from being tried;cosign verifyper manifest, so about 27 for nine unchanged images. The per-verify time (3.4 to 4.5 s) was measured by the earlier work on this branch, not by me;What the first publish run after merge must show
Before the build stack every image digest is still new, so this run exercises the "new" path only.
signing now: … (no signature attached)lines, then9 images reference(s): 9 signed now, 0 already signed5 charts reference(s): 5 signed now, 0 already signedPASS: 27 manifest(s) verified,PASS: 5 single manifest(s) verified)new subject:lines,14 signed reference(s): 14 new provenance subject(s), 0 already attested (skipped), and noasking againlineverified provenance of … (attested by this run, commit <sha>), thenverified the provenance of 14 artifact(s)9 of 9 image digests are new; 5 of 5 chart digests are new, fourteen rows, every "Provenance names commit" cell is this commit, image tagsdev-<sha>, aether listed twice (X.Y.Z-<sha>andX.Y.Z)publish-verifyrun that follows is greenOptional, and the maintainer's call (it is a re-run on
main): re-run that publish for the same commit. It is the only way to see the skip path against the real services before the build stack.already signed: … (first signature attached <time>; 1 signature(s) on the manifest),0 signed now, 9 already signed0 new provenance subject(s), 14 already attested (skipped)and the::notice::, if the chart packages rebuilt identically (otherwise 5 new, 9 skipped)(existing: built first by commit <sha> (<run url>, <time>))0 of 9 image digests are newAfter the build stack, on the first commit that changes no image: the same lines for the images on an ordinary run, with an older commit named.
Merge order
This PR first, then #1465, #1466, #1467. It changes nothing observable while digests still churn, apart from a few extra lookups. If the build stack went first, each unchanged digest would collect a signature and an attestation per commit until this lands.
One thing for #1466 when it rebases over this: both add a "Which commit built this digest" section to
docs/verifying-releases.md. The one here is written for the attest-once rule; #1466's describes the attest-every-commit behaviour ("three signatures and three attestations") and reads the commit fromcosign verify -o json, which prints none with cosign 3.1.2 (measured above). This one should win the conflict.Written by an agent, finishing a branch another agent left unfinished.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr