Skip to content

release: sign the release keylessly with cosign, no key material and no secret - #501

Merged
scttfrdmn merged 5 commits into
mainfrom
ci/keyless-cosign-release-signing
Sep 15, 2026
Merged

scttfrdmn merged 5 commits into
mainfrom
ci/keyless-cosign-release-signing

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

"why are we creating a gpg signing key? none of my other projects do this"

Two answers, and only one of them is a defect.

The GPG key was never signing the release. It signs the rpm's embedded signature and the apt/yum repository metadata, and the repository half genuinely needs it — that is how apt and dnf verify a repo, and there is no cosign substitute for it. That machinery is dormant and stays exactly as it is. lith doesn't do this because lith has no apt/yum repository.

Nothing in the release path was signed at all. v0.14.0 published 18 assets: 9 artifacts and a .sha256 sibling for each. A hash file served from the same release as the asset it describes detects a corrupt download. It proves nothing whatsoever about origin — whoever can replace an asset can replace its hash file in the same motion, and a user following the published instructions would verify the tampered pair against itself and get OK.

So this PR signs the release, keylessly, with no key material and no repository secret.

What it does

publish writes an aggregate checksums.txt over every published artifact and signs it with cosign sign-blob --bundle, exchanging the run's OIDC token for a short-lived Fulcio certificate. Two assets are added:

asset what it is
checksums.txt one sha256sum line per published artifact
checksums.txt.cosign.bundle signature + certificate + Rekor inclusion proof, in one file

Chain of custody: bundle → checksums.txt → every asset. --bundle rather than --output-signature/--output-certificate because it carries the transparency-log inclusion proof too, so a user runs one offline command:

cosign verify-blob --bundle checksums.txt.cosign.bundle \
  --certificate-identity https://github.com/scttfrdmn/objectfs/.github/workflows/release.yml@refs/tags/vX.Y.Z \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  checksums.txt
sha256sum -c checksums.txt

No secret is created and no repository setting changes. id-token: write on the publish job is the entire requirement. That is the point, and not only for convenience: the existing GPG path in package-linux warns and exit 0s when GPG_SIGNING_KEY is absent — which is why the rpms shipped so far are unsigned. A signing mechanism whose failure mode is silently unsigned is the one shape worse than none, because the absence is invisible. Keyless has nothing that can be missing.

Strictly additive — the asset-name contract is untouched

Every existing asset keeps its name. Every per-asset .sha256 keeps its name, its format and its content, because scripts/install.sh fetches <asset>.sha256 by exact name and is verified end to end against real releases including the wget-only path. The release notes now lead with the authenticated command and label the per-asset check as integrity-only, which is all it has ever been.

Second defect fixed: publish could not tell a truncated artifact from a good one

The new step fails closed if any artifact is missing, if any .sha256 sibling is missing, or if a sibling and checksums.txt disagree about a digest. Publishing two hash sources that can disagree is worse than publishing one, because a user cannot tell which is lying. It also catches the duller version — an artifact that arrived truncated from download-artifact, which nothing previously noticed.

All five paths were exercised locally against fabricated assets: happy path, tampered sibling, missing sibling, missing artifact, tampered artifact. The four bad ones each exit non-zero with the right diagnosis.

Tests

internal/config/release_signing_test.go, six tests, each verified by mutation:

mutation caught by
drop id-token: write TestPublishCanMintAnOIDCToken
replace the executed cosign verify-blob with true TestTheSignatureIsVerifiedWhereItIsMade
rename the signing step both scoped tests
hard-code --certificate-identity TestTheCertificateIdentityHasOneDefinition
inject secrets.COSIGN_KEY into the step TestTheSigningPathIsKeyless
drop sha256sum "$pkg" > "$pkg.sha256" TestEveryAssetKeepsItsChecksumSibling
float to cosign-installer@v4 TestCosignInstallerIsPinnedToAnExactVersion

Two of those are worth naming:

  1. The verification test initially did not catch its own mutation. It searched all of release.yml, and cosign verify-blob also appears a dozen lines further down inside the release-notes echo block, as documentation for users. So with the executed call replaced by true, the test happily matched the prose. Both tests now cut the named step out first, and the name is a shared constant so a rename cannot silently narrow one of them to nothing.
  2. cosign-installer@v4 does not resolve. Its floating majors stop at v3 — git/ref/tags/v4 is a 404 while v4.1.2 resolves. Measured against the API, not assumed. A bare @v4 would have failed on a tag, after the artifacts existed and the image had been pushed.

What is not here: goreleaser

"I use goreleaser and it takes care of creating things for me"

Evaluated empirically — goreleaser 2.18.1 installed, candidate config written, goreleaser check and goreleaser release --snapshot actually run. It does not hold up as one PR right now, and the reason is measured rather than argued. Deferred to a tracking issue with the findings, including the parts that do work (the exact 5-tarball naming, the objectfs-linux-armv7 inner binary name install.sh hard-requires, and per-asset .sha256 via checksum.split).

The headline blocker: goreleaser check fails with field key_id not found in type config.NFPMRPMSignature, and the schema confirms it accepts key_file only. nfpm's rpm signing needs the 16-hex key_id. That is a correctness regression in signing, which per this project's own rule must fail closed rather than degrade quietly.

Unverifiable until a tag

The signing step cannot execute on a PR — publish runs only on a tag. Everything checkable without one has been checked: the shell logic against fabricated assets, the identity string against the OIDC claim format, the action ref against the GitHub API, and the workflow against the six tests. The first real proof is the next release, and if it fails it fails before gh release create, so a broken signature cannot become a published one.

Nothing in the release path was signed. Per-asset .sha256 siblings are
served from the same release as the assets they describe, so they detect a
corrupt download and prove nothing about origin.

publish now writes an aggregate checksums.txt over every artifact and signs
it with 'cosign sign-blob --bundle' using the run's OIDC token. No secret,
no key to rotate. Contrast the GPG path in package-linux, which warns and
exits 0 when its secret is absent and therefore ships unsigned rpms.

Strictly additive: every asset name and every .sha256 sibling is unchanged,
because scripts/install.sh fetches those by exact name.

The certificate identity is defined once in the job env and used by both the
verify step and the release notes, so the documented command cannot drift
from the one that is executed.

cosign-installer is pinned to v4.1.2 rather than @v4: its floating majors
stop at v3 and git/ref/tags/v4 is a 404, so @v4 would fail on a tag with the
image already pushed.
Found by mutation, not by reading. Replacing the executed `cosign verify-blob`
with `true` left TestTheSignatureIsVerifiedWhereItIsMade passing, because the
step that prints the release notes documents the same command for users a dozen
lines further down. The test was matching prose while the verification was gone.

Both tests now cut the named step out of release.yml first, and the step name is
a shared constant so a rename cannot narrow one of them to nothing. Re-verified:
removing the executed call fails, and renaming the step fails both.
@scttfrdmn scttfrdmn added type: ci-cd Continuous integration or deployment improvements type: security Security vulnerability or hardening priority: high Important issue that should be addressed soon area: ci-cd CI workflows, gates, and release automation area: build Build system, compilation, packaging labels Sep 15, 2026
golangci-lint's modernize analyzer blocks on changed code. Also adds the guard
the index form silently lacked: an action reference with no ref at all would
have panicked on Fields()[0] instead of reporting.
CHANGELOG.md conflicted with #500's entry: both added an Unreleased section at
the same line. Resolved by keeping both, one `### Added` and one `### Fixed`, in
Keep a Changelog order. No content dropped from either side. release.yml merged
without conflict — #500 touched the job graph's `needs:`, this branch touched the
publish job's steps and permissions.
@scttfrdmn
scttfrdmn enabled auto-merge (squash) September 15, 2026 22:43
@scttfrdmn
scttfrdmn merged commit 6e68b54 into main Sep 15, 2026
42 of 43 checks passed
scttfrdmn added a commit that referenced this pull request Sep 15, 2026
CHANGELOG conflict only, and the two sides do not overlap: #500/#501 added
### Added and ### Fixed, this branch adds ### Changed and ### Removed. Resolved
by keeping both in Keep a Changelog order (Added, Changed, Removed, Fixed).
Verified the result is the exact union of both parents' Unreleased sections.
scttfrdmn added a commit that referenced this pull request Sep 17, 2026
…ver existed (#523)

The next release is 0.15.0, not the 0.16.0 the milestone was titled. Four lines in the
Unreleased section described the CargoShip upload-path removal as having happened "in
v0.15.0" — it shipped in 0.12.0 (#362, 2026-08-08) — and CLAUDE.md repeated the claim.
A fifth said a tier defect was "the v0.15.0 defect"; that one was v0.10.1. No v0.15.0
tag, changelog section, or module-proxy entry has ever existed, so the number is free
and skipping it would have preserved five wrong references to justify a milestone title.

Promotes Unreleased to [0.15.0] - 2026-09-17: seekable compression framing end to end
(#185, via #509/#513/#516) and the GoReleaser convergence (#502) with what it let us
delete. Bumps the version constant, which is the authority the changelog link test and
the packaging tests read.

Also corrects the signing claims across four documents (#505). README.md, docs/index.md
and docs-platform/guide/getting-started.md all said the project "does not sign releases
yet"; #501 signs checksums.txt keylessly with cosign. Each now states the two positions
separately, because neither covers the other: the release is signed, the .deb and .rpm
files are not. The verify command is the one release.yml both runs and prints into the
notes — a bundle, not the --certificate/--signature pair a first draft of this invented.
README's claim that the apt/yum repository is "built and tested on every pull request"
also went with #520, which deleted that machinery.
@scttfrdmn
scttfrdmn deleted the ci/keyless-cosign-release-signing branch September 20, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build system, compilation, packaging area: ci-cd CI workflows, gates, and release automation priority: high Important issue that should be addressed soon type: ci-cd Continuous integration or deployment improvements type: security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant