Skip to content

fix(publish): each digest is signed and attested once; an unchanged digest is verified against the workflow, not the commit (#1378) - #1474

Merged
bpalermo merged 1 commit into
mainfrom
upgrade/publish-sign-attest-new
Oct 8, 2026
Merged

bpalermo merged 1 commit into
mainfrom
upgrade/publish-sign-attest-new

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

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:

  • the same digest would get one more signature and one more attestation with every commit (about seventeen a day);
  • --source-digest <this commit> is the wrong question for a digest an older commit built;
  • gh attestation verify fetches 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:

  1. the registry's referrers index of each manifest. No signature referrer on any one of them means not signed, and no cosign verify is spent;
  2. //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:

  1. GitHub's attestation store lists a provenance attestation for it (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";
  2. what is listed verifies as this repository's publish workflow (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. Every gh attestation verify here passes --limit 1000, the maximum gh accepts. 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 the appVersion of all four charts is {STABLE_GIT_VERSION}, aether's bare X.Y.Z one 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.md gets "Which commit built this digest" and a corrected --source-digest / --limit explanation; the runbook's signing section describes the new behaviour.

publish-verify.yaml is not touched, and nothing it calls changed behaviour (published-chart-refs.sh gained an optional --tags; its default output is the same).

Evidence

Measured, read-only, against the real store and registry with a digest main published (gh 2.102, the pinned cosign 3.1.2):

  • the attestations API answers 200 with a one-element list for an attested digest and 404 for an unknown one; the script's header parsing reads both;
  • gh attestation verify … --limit 1000 --format json passes, and the JSON fields the script and the doc read hold the commit and the run; --limit 1001 is refused;
  • a wrong --source-digest fails with expected SourceRepositoryDigest to be …, got <the commit>;
  • cosign verify -o json prints no commit for a cosign 3 bundle ("optional":{}); --certificate-github-workflow-sha does pin it. The doc gives the second.

Tests (all hermetic: fake curl, cosign, bazel, gh):

Case Where Result
new digest: signed and attested both tests, "every digest new" 9 cosign sign --recursive in the old order; 5 of 5 subjects; each verified with --source-digest
unchanged, signed and attested: neither, verification passes "re-run" in both 0 sign calls after 27 verifies; subjects=0, empty checksums file, verify green with no commit pinned
unchanged, signature missing: signed sign test, "two of nine signed before" one child unsigned, another identity, an unanswered lookup: each signed again, whole
attestation lookup error: the job fails, nothing skipped provenance test 503, an HTML 200 and no answer each exit 1 after 4 attempts; the digest is in neither list; nothing in $GITHUB_OUTPUT. One 502 then an answer passes
mixed set provenance test, "commit B" the checksums file holds exactly the two new digests; the three unchanged are verified without a commit and name commit A
nothing new provenance test attest skipped, the store gains nothing
workflow wiring provenance test the steps run the scripts, the if: is there, no inline cosign sign or --source-digest is left

Red first:

  • the provenance test against the saved work-in-progress script and the unwired workflow: 44 of 98 checks failed;
  • the new sign-state and --tags checks failed before their code existed (5 and 5);
  • 23 mutations, each applied to a scratch copy and each turning its test red: unknown read as "none", unknown read as "attested", a commit pinned on an unchanged digest, no commit pinned on a new one, --limit 30, every digest attested, "listed" taken as enough, no retry, newest instead of oldest origin, zero verified passing, the if: removed, inline signing back; and for signing: unknown read as signed, never skip, never sign, no --recursive, referrers taken as enough, a failed cosign sign ignored, 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 //... with fail_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.yaml only runs on main. So the following are unproven until the first publish after merge:

  • the whole workflow path: the steps, the id and if:, GH_TOKEN on the subjects step, the summary redirect;
  • quay's referrers index as the "not signed" answer for a fresh digest, and whether it lists a creation time for a signature (if not, the line says so; cosmetic);
  • actions/attest with the script's checksums file (the format is unchanged from the inline step);
  • what actions/attest does 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;
  • the skip path against real services. It can be seen before the build stack only by re-running a publish for a commit already published (second checklist);
  • the cost of the "already signed" question after the build stack: one cosign verify per 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;
  • whether a re-run rebuilds byte-identical chart packages. If not, the charts show as new on a re-run, which is still correct.

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.

  • "Sign published images": nine signing now: … (no signature attached) lines, then 9 images reference(s): 9 signed now, 0 already signed
  • "Sign published charts": 5 charts reference(s): 5 signed now, 0 already signed
  • both signature verify steps pass as before (PASS: 27 manifest(s) verified, PASS: 5 single manifest(s) verified)
  • "Provenance subjects": fourteen new subject: lines, 14 signed reference(s): 14 new provenance subject(s), 0 already attested (skipped), and no asking again line
  • "Attest build provenance" ran (not skipped) and reports 14 subjects
  • "Verify the provenance attestations": fourteen verified provenance of … (attested by this run, commit <sha>), then verified the provenance of 14 artifact(s)
  • the run summary: 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 tags dev-<sha>, aether listed twice (X.Y.Z-<sha> and X.Y.Z)
  • the publish-verify run that follows is green

Optional, 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.

  • nine already signed: … (first signature attached <time>; 1 signature(s) on the manifest), 0 signed now, 9 already signed
  • 0 new provenance subject(s), 14 already attested (skipped) and the ::notice::, if the chart packages rebuilt identically (otherwise 5 new, 9 skipped)
  • "Attest build provenance" shown as skipped (or attesting only the five charts)
  • verify lines of the form (existing: built first by commit <sha> (<run url>, <time>))
  • the summary says 0 of 9 image digests are new

After 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 from cosign 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

…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
Copilot AI balanced review requested due to automatic review settings October 8, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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.

@bpalermo
bpalermo merged commit 79a6c30 into main Oct 8, 2026
31 checks passed
@bpalermo
bpalermo deleted the upgrade/publish-sign-attest-new branch October 8, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants