Skip to content

Verify the stage provenance before releasing - #4555

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes:masterfrom
saschagrunert:verify-stage-provenance
Oct 30, 2026
Merged

kubernetes-prow[bot] merged 1 commit into
kubernetes:masterfrom
saschagrunert:verify-stage-provenance

Conversation

@saschagrunert

@saschagrunert saschagrunert commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

krel release checks the staged artifacts against the subjects of the stage provenance, but it doesn't verify the provenance itself, and a failed check only logs a warning. Since #4507 the stage run signs the provenance in place as krel-staging, and slsa-framework/verifier v0.1.0 is out, so the check can verify it now:

  • processAttestation verifies the Sigstore bundle with the SLSA verifier before it uses the subjects: signed by sigstore::https://accounts.google.com::krel-staging@k8s-releng-prod.iam.gserviceaccount.com, built from github.com/$K8S_ORG/$K8S_REPO by https://git.k8s.io/release/docs/krel. Both the SLSA v0.2 provenance of the released krel and the v1 provenance of main verify. A bare, unsigned statement fails. Only the statement that verified is used from then on, for the subjects and for the final provenance, instead of reading the file again. The signature check and the SLSA verifier give up after five minutes each, so that a Sigstore outage fails the release instead of hanging it.
  • A failed provenance check stops official releases (--nomock) before they publish anything, instead of only logging a warning. Mock releases fail too when the stage provenance is signed but doesn't verify, so that they catch regressions before an official release. They only warn when it is unsigned, like the one of a local stage, or when they run from a fork, which stage runs of older krel releases don't record as their source.
  • New direct dependencies: github.com/slsa-framework/verifier v0.1.0 and github.com/policylabs/collector v0.4.0.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Plan on #2616. Mock releases publish without a final provenance.json when the check fails; with #4550, which signs it, they skip it with a warning too.

Checked locally against the signed stage provenance of v1.37.1 (stage/v1.37.0-19+b051586fb9ba74, SLSA v0.2): it verifies, while a bare statement, another source repository and a tampered signature fail. The SLSA verifier checks the builder only from level 2 on (a trusted builder bound to its signer), so that is the level the check requires; the stage run still meets SLSA build level 1 only, since it signs its provenance itself. The unit tests record the signature verification instead of fetching the Sigstore trust root; a test with a real signed stage provenance against a pinned trusted root follows separately.

Tested end to end with a mock stage (Cloud Build fc5b9edb in k8s-release) and a mock release (f2b2aac0) of master, with krel built from a branch that combines #4555, #4550 and #4551: the stage attached the signed image provenance to 54 mock images (cosign verify-attestation passes) and signed provenance.json in place; the release verified that stage provenance and all 451 staged artifacts, signed the final provenance in place before publishing, and the published provenance.json verifies against the released kubectl with cosign verify-blob-attestation.

Does this PR introduce a user-facing change?

`krel release` verifies the signature, builder and source of the stage provenance with the SLSA verifier, and official releases fail when the provenance check fails.

@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. needs-priority cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 8, 2026
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch from 4b4b9ab to da3654d Compare October 8, 2026 10:01
@kubernetes-prow
kubernetes-prow Bot requested a review from jimangel October 8, 2026 10:01
@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 8, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from salaxander October 8, 2026 10:01
@kubernetes-prow kubernetes-prow Bot added area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 8, 2026
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch 2 times, most recently from e9c59e0 to f28aed5 Compare October 8, 2026 10:29
@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2026
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch from f28aed5 to 05b86b2 Compare October 13, 2026 06:32
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 13, 2026
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch from 05b86b2 to f127fc7 Compare October 13, 2026 11:01
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 13, 2026
@saschagrunert saschagrunert changed the title WIP: Verify the stage provenance before releasing Verify the stage provenance before releasing Oct 13, 2026
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 13, 2026
@saschagrunert

Copy link
Copy Markdown
Member Author

@kubernetes/release-engineering PTAL

@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2026
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch from f127fc7 to 452490d Compare October 16, 2026 06:21
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2026
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch from 452490d to 38ebb53 Compare October 16, 2026 06:28
@saschagrunert

Copy link
Copy Markdown
Member Author

@kubernetes/release-engineering PTAL

Comment thread pkg/anago/release.go Resolved
Comment thread pkg/release/provenance.go
// verifySignatures verifies the signatures of the stage provenance and
// records the outcome in it, against the sigstore public good instance
// when nil.
verifySignatures func(plattestation.Envelope) error

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.

The tests always replace envelope.Verify() with verifiedBy, so the path official releases take (the collector verifying against the Sigstore trust root, then the SLSA verifier reading the recorded *sapi.Verification) isn't covered. Could we add a test with a real signed stage provenance as testdata, like the one of v1.37.1 you checked, verified against a pinned trusted root so it doesn't need the network? Fine as a follow-up.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed, I'll do this in a follow-up: testdata of the v1.37.1 stage provenance verified against a pinned trusted root.

Comment thread pkg/release/provenance.go Resolved
Comment thread pkg/release/provenance.go Resolved
Comment thread pkg/release/provenance.go Resolved
Comment thread pkg/release/provenance.go Resolved
krel release now verifies the provenance of the stage run with the SLSA
verifier before it checks the staged artifacts against its subjects: it
has to be a sigstore bundle signed by
krel-staging@k8s-releng-prod.iam.gserviceaccount.com about a build of
the Kubernetes repository by the krel builder. Only the verified statement
is used for the subjects and the final provenance, and the verification
gives up after five minutes. A failed check stops official releases and
mock releases with a signed stage provenance; mock releases only warn when
the stage provenance is unsigned or they run from a fork.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
@saschagrunert
saschagrunert force-pushed the verify-stage-provenance branch from 38ebb53 to 795f474 Compare October 30, 2026 17:58
@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 30, 2026

@xmudrii xmudrii 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.

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: saschagrunert, xmudrii

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:
  • OWNERS [saschagrunert,xmudrii]

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

@kubernetes-prow
kubernetes-prow Bot merged commit 6bd61e7 into kubernetes:master Oct 30, 2026
12 of 13 checks passed
@kubernetes-prow kubernetes-prow Bot added this to the v1.38 milestone Oct 30, 2026
@saschagrunert
saschagrunert deleted the verify-stage-provenance branch November 2, 2026 06:51
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. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants