Skip to content

feat(release): sign staged metadata.json with cosign - #9089

Merged
cert-manager-prow[bot] merged 2 commits into
cert-manager:release-1.21from
FelixPhipps:sign-metadata-cosign-release-1.21
Aug 5, 2026
Merged

cert-manager-prow[bot] merged 2 commits into
cert-manager:release-1.21from
FelixPhipps:sign-metadata-cosign-release-1.21

Conversation

@FelixPhipps

Copy link
Copy Markdown
Member

Backport to release-1.21 of the master change (same edit; make/release.mk is identical across these branches).

Description

Problem

cmrel gcb publish now verifies a cosign signature over the staged metadata.json and, once enforcement is switched on, fails closed if there's no valid metadata.json.sig next to it in gs://cert-manager-release. metadata.json lists every release artifact and its checksum, and it's read back from the same bucket it was uploaded to — so signing it with the release KMS key (which random bucket writers don't hold) is what makes it trustworthy.

The staging job — make upload-release — never produced that signature:

  • Broken publish: upload-release is a plain rclone copyto of the release dir; it never installed cosign or signed anything, so no .sig was ever staged. With the enforcing default shipped, cmrel gcb publish refuses every release (this broke the v1.21.1 patch release).
  • Untrustworthy metadata: without a signature over metadata.json, anyone who can write to the staging bucket could alter the artifact list or checksums and the publish step had no way to detect it.

Solution

Sign $(bin_dir)/release/metadata.json with cosign (sign-blob) in make/release.mk, producing metadata.json.sig. The key is derived from the existing CMREL_KEY — rewritten to the gcpkms://…/versions/N form cosign expects — so callers still set only one key. --tlog-upload=false keeps this private staging artifact out of the public Rekor log and keeps verification offline. upload-release already copies the whole release dir, so the .sig ships alongside metadata.json with no rclone change, and cosign is already a make tool, so no cloudbuild change is needed. Local make release-artifacts is unaffected — signing only runs in the paths that already require CMREL_KEY.

Test plan

  • make --dry-run … metadata.json.sig expands to cosign sign-blob --yes --tlog-upload=false --key gcpkms://…/versions/1 --output-signature … metadata.json and the Makefile parses clean (recipe lines tab-indented, no missing separator).
  • KMS key derivation verified: CMREL_KEY ending …/cryptoKeyVersions/1 becomes gcpkms://…/versions/1, matching what cosign verify-blob --key gcpkms://… uses on the publish side.
  • Dependency wiring confirmed: the .sig target builds metadata.json first and pulls in $(NEEDS_COSIGN) (pinned cosign=v2.6.3).
  • Cross-version check to run before enforcement is flipped on: one cmrel publish --nomock against a freshly-signed staged release, confirming publish-side cosign v1.13.6 verify-blob accepts the v2.6.3-produced detached signature.

Release note

The release staging process now signs metadata.json with cosign so the publish step can verify its authenticity.

cmrel gcb publish now verifies a cosign signature over the staged
metadata.json and (once enforced) fails closed without one. The staging
job (make upload-release) never produced that signature, which broke
publishing (see the v1.21.1 incident).

Sign $(bin_dir)/release/metadata.json with cosign (sign-blob, keyed off
the existing CMREL_KEY, no tlog upload) in make/release.mk. upload-release
already copies the whole release dir, so metadata.json.sig ships alongside
it, and cosign is already a make tool, so no cloudbuild change is needed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@cert-manager-prow cert-manager-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 30, 2026
Guard the metadata.json.sig target with an explicit CMREL_KEY empty
check, consistent with the helm-chart signing target in manifests.mk.
Without it, an unset CMREL_KEY expands COSIGN_KMS_KEY to a bare
"gcpkms://" and cosign fails with an opaque KMS error; this gives an
actionable message, notably when the target is invoked directly rather
than via the release chain.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Felix Phipps <[email protected]>
@FelixPhipps

Copy link
Copy Markdown
Member Author

/kind feature

@cert-manager-prow cert-manager-prow Bot added kind/feature Categorizes issue or PR as related to a new feature. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 5, 2026

@wallrj wallrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Byte-identical to the approved master PR #9087 (including the fail-fast CMREL_KEY guard from e21fd92), make/release.mk is identical on release-1.21 and master so the change lands in the same context, and all release-1.21 presubmits are green.

/lgtm
/approve

with claude fable-5

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wallrj

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2026
@cert-manager-prow
cert-manager-prow Bot merged commit b1c43c1 into cert-manager:release-1.21 Aug 5, 2026
6 checks passed
@wallrj wallrj mentioned this pull request Sep 1, 2026
39 of 41 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants