Repository navigation
Verify the stage provenance before releasing - #4555
kubernetes-prow[bot] merged 1 commit into
Conversation
4b4b9ab to
da3654d
Compare
e9c59e0 to
f28aed5
Compare
f28aed5 to
05b86b2
Compare
05b86b2 to
f127fc7
Compare
|
@kubernetes/release-engineering PTAL |
f127fc7 to
452490d
Compare
452490d to
38ebb53
Compare
|
@kubernetes/release-engineering PTAL |
| // 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Agreed, I'll do this in a follow-up: testdata of the v1.37.1 stage provenance verified against a pinned trusted root.
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>
38ebb53 to
795f474
Compare
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
6bd61e7
into
kubernetes:master
What type of PR is this?
/kind feature
What this PR does / why we need it:
krel releasechecks 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 askrel-staging, and slsa-framework/verifier v0.1.0 is out, so the check can verify it now:processAttestationverifies the Sigstore bundle with the SLSA verifier before it uses the subjects: signed bysigstore::https://accounts.google.com::krel-staging@k8s-releng-prod.iam.gserviceaccount.com, built fromgithub.com/$K8S_ORG/$K8S_REPObyhttps://git.k8s.io/release/docs/krel. Both the SLSA v0.2 provenance of the released krel and the v1 provenance ofmainverify. 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.--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.github.com/slsa-framework/verifierv0.1.0 andgithub.com/policylabs/collectorv0.4.0.Which issue(s) this PR fixes:
None
Special notes for your reviewer:
Plan on #2616. Mock releases publish without a final
provenance.jsonwhen 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.jsonin place; the release verified that stage provenance and all 451 staged artifacts, signed the final provenance in place before publishing, and the publishedprovenance.jsonverifies against the releasedkubectlwithcosign verify-blob-attestation.Does this PR introduce a user-facing change?