Repository navigation
build(ci): upgrade cosign to v3, and hold the signature layout while doing it - #924
Conversation
…doing it `sigstore/[email protected]` bootstraps cosign **v2.4.1** (the SHA-256 hardcoded in that action matches the real v2.4.1 binary, 8b24b946…89249b), so this repo has been signing with cosign 2 all along. Move to the 4.x installer line, pinned by commit: v4.1.2 (6f9f177, "Bump cosign to 3.0.6") installs cosign **v3.0.6**, sha256 c956e5df…3f4c74 — verified by downloading the binary and comparing it against the constant in the pinned commit. Pinned by SHA rather than by tag, unlike this repo's other actions, because this job holds `packages: write` + `id-token: write`: a moved tag could push and sign under our genuine OIDC identity and `cosign verify` would pass, since the certificate really would be this workflow's. No `cosign-release:`, so the pinned commit fixes the binary too, with no trust in a release asset. THE PART THAT IS NOT A VERSION BUMP. cosign v3 defaults `sign` to `--new-bundle-format=true`, which writes an OCI 1.1 referring artifact; on a registry with no Referrers API (ghcr — /referrers 404s, re-confirmed against ghcr.io/bpalermo/aether/agent with a token that gets 200 from tags/list) go-containerregistry lands it under the fallback tag `sha256-<hex>`, an index with no `.sig` suffix. Measured on a local registry that 404s /referrers the same way: cosign 3.0.6 sign (defaults) -> tag sha256-2293b3… cosign 3.0.6 sign --new-bundle-format=false -> tag sha256-2293b3….sig That would break scripts/verify-published-artifacts.sh (#880), which resolves `sha256-<digest>.sig` — eight MISSING signatures per commit. Worse, a cosign v2 client reading a v3-format signature reports `Error: no signatures found` (exit 10, measured), indistinguishable from unsigned, while this workflow's own verify step stays green because it runs the same v3 binary and v3 reads both formats. So: upgrade the binary, hold the layout. Every artifact published to date is the legacy layout and stays byte-compatible with it. The same flag is added to `cosign verify` as an assertion, not for compatibility: v3 verify auto-detects the layout and so passes against either one, which would make the step blind to the signer changing where signatures land. Pinned, it fails closed — exit 10 against a v3-format signature, measured, versus exit 0 for the auto-detecting default. `--new-bundle-format` is deprecated upstream, so this is a stay of execution. scripts/ghcr-lib.sh records the coupling: when the flag goes, the signer and ghcr_signature_tag() move in the same commit or the verifier goes blind. Evidence, all read-only against the registry: - cosign 3.0.6 verifies the existing v2.4.1-produced signatures with the exact flags this workflow uses (exit 0 against agent@sha256:c8a2dd3a…). - `scripts/verify-published-artifacts.sh 7de67d2 b680a00` -> PASS: 40, unchanged before and after. - No bare `sha256-<hex>` tag exists in any of the eight repositories today (78 `.sig` tags each), so nothing else is writing referrers here. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Follow-up measurement: the two flag values are NOT symmetricA peer session ran the control I suggested and it disproved a symmetry I had asserted. Recording it here because the PR's own comment could otherwise be generalised wrongly. Measured with a v3.0.6 binary against two real ghcr artifacts — one signed by cosign 2.4.1, one by 3.0.6:
That matters for whoever migrates later: flipping to the new format and pinning What actually gates in both directionsThe registry, not the binary. Per digest the two layouts are mutually exclusive: aether already has half of this, arrived at from an unrelated direction: The half we lack is the negative: we assert As the peer put it, the value is in checking the registry rather than asking the same binary that just wrote the signature whether it likes it — which is a better statement of the original problem than the one in this PR's description. No change requested to this PR: |
…t while doing it (#924)" (#926) This reverts commit 1e31e3a. The publish for 1e31e3a FAILED at the signing step: Error: must provide --new-bundle-format or --bundle where applicable with --signing-config or --use-signing-config cosign v3.0.6's keyless path rejects --new-bundle-format=false. So "upgrade the binary, hold the layout" — the entire premise of #924 — is not available with v3 keyless signing. v3 requires the new bundle format here. This could only be found by running it. #924 said so plainly: the signing step was never executed because keyless signing needs the workflow's OIDC token, and everything about aether's own signing path was source-derived plus a local rehearsal with a throwaway key. The rehearsal used a key, and the key path does not carry this constraint. That gap was disclosed, and it is exactly where the defect was. Reverting restores a working publish rather than leaving main in a state where every publish fails and every image ships unsigned. Note on blast radius: the sign step runs AFTER the pushes, deliberately, so a signing failure never leaves images unpublished. The consequence is narrower and must be recorded rather than glossed: **1e31e3a's images are published and UNSIGNED.** No deployed artifact is affected — talos runs rev237 (b680a00) — and publish-verify.yaml (#913) will report the missing signatures rather than staying quiet, which is the gate working as designed. The upgrade is still worth doing. It needs the layout migration done properly: accept v3's fallback-index layout and teach ghcr_signature_tag() and verify-published-artifacts.sh to resolve `sha256-<digest>` as well as `sha256-<digest>.sig`, so already-published artifacts stay verifiable across the change. Tracked separately. Refs #924 Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Bruno Palermo <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
Second attempt. #924 tried to upgrade the binary while HOLDING the legacy `sha256-<digest>.sig` layout, and its publish failed: Error: must provide --new-bundle-format or --bundle where applicable with --signing-config or --use-signing-config cosign 3's keyless path rejects --new-bundle-format=false outright, so holding the layout is not a reachable state. Migrating is the only way forward, and the migration has to carry the verifier with it in the same commit — otherwise everything published before today becomes unverifiable the moment the signer changes shape. So: * installer -> v4.1.2 pinned BY SHA (bootstraps cosign v3.0.6). We were two majors behind, not one: v3.7.0 sets no cosign-release and defaults to v2.4.1. The installer version is not the cosign version. * `cosign sign --recursive` with no format flag — v3's default is the new layout, and the flag that would pin the old one is what broke #924. * ghcr-lib.sh grows ghcr_signature_tag_legacy/_bundle and, more importantly, ghcr_signature_layout(), which reports legacy|bundle|none|BOTH. The `both` case is the point. "Accept either layout" is one grep away from "accept anything", and a double-write or half-finished migration is exactly the state that presence-only checking reports as a healthy signature. It is now a distinct, named failure. NOT pinning --new-bundle-format on verify, deliberately, and the workflow says why: measured, `=false` fails closed against a v3 signature (exit 10) but `=true` still ACCEPTS a legacy .sig (exit 0). It asserts nothing. Pinning it there would be decoration. The layout assertion belongs in publish-verify.yaml, which asks the REGISTRY rather than asking the same binary that just wrote the signature whether it likes it. scripts/check-signature-layout.sh covers all four states plus the subtlety that `sha256-<d>.sig` must not satisfy the bare-tag check — `grep -qxF` matches whole lines, and relaxing it to `grep -qF` would silently report `both` for every legacy signature. Negative control: that exact relaxation turns the suite red on two cases and green again on restore. Also corrected the rules_img note, which stated inference in the same register as measurement: the docstring saying signatures are pushed as an OCI referrer is SOURCED; "with no fallback" is not, because that push lives in a prebuilt Go binary absent from the archive. Regression, against the live registry: 7de67d2 (cosign 2) PASS: 20 artifact(s) 5325a57 (cosign 2) PASS: 20 artifact(s) 1e31e3a (unsigned) FAIL: 8 of 20 missing, exit 1 Refs #924 Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Bruno Palermo <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
Upgrades the image signer from cosign v2.4.1 to v3.0.6, and — because v3 changes where a signature lands — holds the on-registry layout fixed rather than letting a version bump migrate the artifact format as a side effect.
Three functional lines change:
Everything else is comment recording why.
What we were actually running
[email protected]has nocosign-release:set, and its default input isv2.4.1. Confirmed not by reading the README but by downloading the binary: the SHA-256 hardcoded in that action commit,8b24b946…89249b, is the realcosign-linux-amd64for v2.4.1. This repo has been signing with cosign 2 the whole time, so this is genuinely a major upgrade.The finding: v3 moves the signature
cosign v3 defaults
signto--new-bundle-format=true(options/sign.go:155). That routes signing throughsignDigestBundle→ociremote.WriteAttestationNewBundleFormat→WriteReferrer, which pushes an OCI 1.1 referring artifact with asubject(sign.go:117,write.go). It is listed as an intended v3 default in the v3.0.0 release notes: "container signatures stored as an OCI Image 1.1 referring artifact".On a registry with no Referrers API, go-containerregistry does not fail — it writes the referrers fallback tag,
sha256-<hex>(colon→dash, no.sig), holding anapplication/vnd.oci.image.index.v1+json.ghcr is such a registry, re-confirmed here rather than inherited from the existing comment — same token, same repo:
Measured, on a throwaway local registry that 404s
/referrersexactly as ghcr doesNo real package touched, no publish triggered, no public transparency log written.
So a blind bump makes
scripts/ghcr-lib.sh'sghcr_signature_tag()resolve a tag that is never written, andscripts/verify-published-artifacts.sh(#880, #913) reports eight MISSING signatures per commit — for artifacts that were, in fact, signed.The worse half: a green publish and blind verifiers
A cosign 2 client does not fail closed on a v3 signature — it reports
no signatures found, byte-identical to "this image was never signed". And because this workflow verifies with the same binary it just signed with, and v3 reads both formats, CI would have been green the whole time. That is the #853 / #882 / #906 shape — a check that cannot fail — so it is called out explicitly rather than discovered later.Why hold the layout instead of migrating
Every artifact this repo has ever published is the legacy layout (78
.sigtags in each of the eight image repositories; zero baresha256-<hex>tags, so nothing else here writes referrers either). Keeping it means no flag day, no split history for the verifier to straddle, and no silent break for any consumer pinned to cosign 2. Migrating the format is a real decision with its own blast radius; it should not ride along inside "upgrade the signer".--new-bundle-formatis deprecated upstream ("this will be the only supported format in future versions" — the deprecation notice lands in v3.1.x), so this is a stay of execution, not a permanent answer.scripts/ghcr-lib.shnow records the coupling in the one place that would go wrong: when the flag disappears, the signer andghcr_signature_tag()move in the same commit, or the verifier goes blind.Why the same flag on
verify— it is an assertion, not compatibilityv3's
verifyauto-detects: it looks for a Sigstore bundle and silently falls back to the tag scheme when it finds none (verify.go:154-159). Left alone it therefore passes against either layout — blind to the exact drift it exists to catch. Pinned, it fails closed:The gate can fail. Proven, not asserted.
Why pinned by commit, unlike every other action here
This job holds
packages: writeandid-token: write. Whoever controls the action installed here can push to our repositories and sign with our OIDC identity — andcosign verifywould pass, because the Fulcio certificate really would be this workflow's. A moved tag is enough. The signature does not protect against a swapped signer; only the pin does.v4.1.2=6f9f17788090df1f26f669e9d70d6ae9567deba6, "Bump cosign to 3.0.6" (resolved via the API, not copied).Why no
cosign-release:Unset, the action installs its bootstrap version by comparing the download against a SHA-256 hardcoded in the pinned commit — so the action pin fixes the cosign binary too, trusting no release asset and no
raw.githubusercontent.comfetch. Verified end to end: the realcosign-linux-amd64v3.0.6 hashes toc956e5df…3f4c74, exactly the constant in6f9f177.Naming a version takes the action's other branch (fetch the release public key, verify the download against it). In v4 that branch is sound — the key's digest is pinned and the old
--insecure-ignore-tlogis gone — but it is more moving parts for no gain, and acosign-release:nobody remembers to bump silently outlives the pin.Version note, stated plainly: cosign's own latest is v3.1.3 (2026-08-06); no installer release ships it (v4.1.2 predates it). v3.1.3 fixes GHSA-fx35-mq7g-6g98, which the advisory scopes to
verify-blob/verify-blob-attestationwith legacy JSON bundles and states explicitly does not affect OCI container image verification — the only cosign flow this repo uses. So v3.0.6 is not exposed here, and the comment says to revisit when an installer release bootstraps 3.1.x. The 3.x installer line is abandoned (last release 2025-10-16, still bootstrapping cosign v2.6.1); 4.x is the only line shipping.Evidence summary
[email protected]6f9f177GET /referrers/<digest>→ 404,tags/list→ 200, same token, aether's own reposha256-<hex>, not.sigexit=10, no signatures foundcosign 3.0.6 verifywith this workflow's exact flags → exit 0 onagent@sha256:c8a2dd3a…(a real 7de67d2 artifact)--new-bundle-format=falsereproduces today's layout.sigtag written; v2.4.1 verifies it, exit 0scripts/verify-published-artifacts.sh 7de67d2 b680a00→PASS: 40 artifact(s), identical before and afterbazel run //:format.checkclean (no files rewritten);bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...green;scripts/ghcr-lib.shis inside//scripts:scripts_shell's glob, so shellcheck really does lint itWhat I could NOT prove, and what to watch
The signing step itself was never executed. Keyless signing needs the workflow's OIDC token, and the rule here is that the release workflow is the only publisher — so nothing in this PR was tested by publishing. Everything above about this repo's signing path is source-derived plus a local-registry rehearsal with a throwaway key; the ghcr side was exercised read-only.
On the first publish after merge, check, in order:
Sign published imagesprintsPushing signature to: ghcr.io/bpalermo/aether/<img>— the new-bundle path prints a different line and would indicate the flag did not take.Verify the signaturesprintsverified 8 signature(s). With--new-bundle-format=falsethis now fails closed if the layout moved.bash scripts/verify-published-artifacts.sh <merge sha>→PASS: 20 artifact(s). This is the real assertion that the.sigtag exists;publish-verifyruns it automatically after the run concludes.If (2) or (3) go red, the rollback is one line: restore
sigstore/[email protected]. The images are pushed by digest in an earlier step, so a signing failure never leaves them unpublished.Noted, not changed
cosign verifyhas no--recursive.sign --recursivesigns the index and every child manifest, but the verify loop reads one index digest per repository, so the per-arch manifests are signed and never verified. Pre-existing, unchanged by this PR, and worth its own issue rather than being smuggled into a version bump.rules_img0.3.21's ownsigning_configdocstring says "The signature is then pushed to the image's repository as an OCI referrer."_SIGN_TARGETS = ["roots", "child_manifests", "referrers"]is indeed which descriptors get signed and not where signatures go — but that does not rescue the approach here, becauseimg deploystill pushes the signer's output as a referrer. Left alone.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr