feat: generate SLSA provenance for release binaries#730
feat: generate SLSA provenance for release binaries#730imjasonh merged 16 commits intoko-build:mainfrom
Conversation
imjasonh
left a comment
There was a problem hiding this comment.
Cool! Always happy to test out better supply chain security workflows 😎
| ARCH=x86_64 # or arm64, i386, s390x | ||
| curl -L https://github.com/google/ko/releases/download/v${VERSION}/ko_${VERSION}_${OS}_${ARCH}.tar.gz | tar xzf - ko | ||
| chmod +x ./ko | ||
| We are one of the first repositories to generate SLSA3+ provenance using the OpenSSF's [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) project. |
There was a problem hiding this comment.
This comment will (hopefully) fall out of date pretty fast. Can we just say, "here's how to install a release", and then later, "here's how to verify the released artifact"? The verifying-the-release section may even make more sense lower in the README, since folks who already have ko installed may not want to scroll past it.
(Longer term I'd love to not have one big README and instead have a real website with docs and tutorials and everything, but until then...)
There was a problem hiding this comment.
I've made some changes. Can you take a look and tell me what you think?
Awesome, thanks! |
| @@ -0,0 +1,13 @@ | |||
| version: 1 | |||
There was a problem hiding this comment.
Does this need to be its own file? I'm worried about this diverging from goreleaser eventually.
Or, if the idea is to eventually only have the SLSA-flavored goreleaser workflow, I wonder if you've considered just adding the SLSA provenance functionality to goreleaser proper, and not having your own fork?
There was a problem hiding this comment.
Does this need to be its own file? I'm worried about this diverging from goreleaser eventually.
right now it needs to be its own file, yes.
Or, if the idea is to eventually only have the SLSA-flavored goreleaser workflow,
correct. In the next release we will support multiple builds, so we should be able to migrate the rest of the config.
I wonder if you've considered just adding the SLSA provenance functionality to goreleaser proper, and not having your own fork?
We have (see goreleaser/goreleaser#2737) and we emailed them, but no concrete plan yet :/
There was a problem hiding this comment.
It sounds like there's still some discussion happening on goreleaser/goreleaser#2737, and I'd kind of like that to land somewhere before proceeding to fork the release process here. If you need any help getting the SLSA provenance generation landed in goreleaser, let me know.
I'd rather not have a forked release process per-target-arch, and long term, I'd prefer to rely on the standard upstream goreleaser if at all possible.
There was a problem hiding this comment.
It sounds like there's still some discussion happening on goreleaser/goreleaser#2737, and I'd kind of like that to land somewhere before proceeding to fork the release process here. If you need any help getting the SLSA provenance generation landed in goreleaser, let me know.
Would love your help. Much appreciated, thanks!
I'd rather not have a forked release process per-target-arch, and long term, I'd prefer to rely on the standard upstream goreleaser if at all possible.
Any particular reason? We'd like to learn about blockers to adoption to improve our solution. Feedback welcome!
Multi-build support will be added next quarter.
There was a problem hiding this comment.
It's mainly just for consistency among our released artifacts. The x86_64 binary is definitely the most used, and if behavior continues to diverge between them I don't want the minority of users to have different behavior. Ideally goreleaser would pick up these improvements (rooting for #2737!) and all our released binaries would immediately and consistently get better.
There was a problem hiding this comment.
SG. What if we land multi-build support in v2? Would that alleviate the problem? I'd like to know what the minimum requirements would be, so that we can target them for our v2 release.
Thanks again for you help and feedback!
There was a problem hiding this comment.
I'm not sure I understand what multi-build support entails, or v2 of what project. In my ideal scenario, goreleaser would be able to be configured to generate and attach attestation documents to releases, which users could use to verify the provenance of each goreleaser-built artifact.
Ideally that's done by just adding generate-attestations: true in the goreleaser.yaml somewhere, and no new dependencies on other projects.
There was a problem hiding this comment.
Sorry for the confusion. What I mean is that in the next release of our SLSA builder, we will support building for multiple arch/os at once, like Goreleaser does. So it would be easy to migrate to our builder instead of Goreleaser with a similar config file.
Ideally that's done by just adding generate-attestations: true in the goreleaser.yaml somewhere, and no new dependencies on other projects.
I'd like to understand better the requirement to use Goreleaser.
Any update on #2737?
|
Any further concern I should address? |
|
I've updated the PR:
A follow-up PR would be to verify the binary pulled in https://github.com/imjasonh/setup-ko/blob/main/action.yml#L41. We're still working on a GHA installer for the verifier, so that is not ready yet :) Appreciate your feedback. Thanks again |
| contents: write # To add assets to a release. | ||
| uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.0 | ||
| with: | ||
| base64-subjects: "${{ needs.goreleaser.outputs.hashes }}" |
There was a problem hiding this comment.
note: this will create an attestation file attestation.intoto.jsonl by default. The name can be customized with the option: attestation-name: xxx.intoto.jsonl if you want.
|
Fyi, this PR is ready to be reviewed. |
I probably won't have the bandwidth to review this closely for at least a week or so. I'm excited to see this progressing though, and especially now that it seems to require fewer changes to the release process. Thanks for pushing on that! 👍 |
|
Friendly ping. Would love to hear your feedback. Thanks again. |
|
This looks pretty good to me. Would it be possible to have the release workflow also attempt to verify it, so we can detect quickly if verification is silently broken due to some future change? @jonjohnsonjr any concerns? |
Codecov Report
@@ Coverage Diff @@
## main #730 +/- ##
=======================================
Coverage 51.40% 51.40%
=======================================
Files 44 44
Lines 3336 3336
=======================================
Hits 1715 1715
Misses 1403 1403
Partials 218 218 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I can do that. How to you typically create the tag? Via a git command or via the GitHub UX?
|
|
I usually do it through the UI, but I think triggering based on new tags should catch both cases. |
|
I have added the verification job. PTAL. |
|
@imjasonh any other feedback you'd like me to address? |
|
As we completed the SLSA provenance generation for release binaries, should we move on with the same for ko images? @imjasonh ^^ |
Generate non-forgeable provenance, as proposed in #729
Below is an example of what the provenance looks like: