Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] add provenance document creation support based on in-toto attestations #2737

Open
developer-guy opened this issue Dec 6, 2021 · 35 comments
Labels
enhancement New feature or request

Comments

@developer-guy
Copy link
Member

developer-guy commented Dec 6, 2021

Is your feature request related to a problem? Please describe.
This is a feature, not related to a problem.

Describe the solution you'd like

Attestations are more like a document/record to give details about how the software was built. in-toto provides/defines very detailed documents for it, so, GoReleaser can generate software provenance documents based on in-toto attestations IMHO.

Tekton Chains is also creating this document based on its format.

Additional context

cc: @dlorenc @caarlos0 @Dentrax @adityasaky @SantiagoTorres

@developer-guy developer-guy added the enhancement New feature or request label Dec 6, 2021
@developer-guy developer-guy changed the title [Proposal] add provenance creation support based on in-toto attestations [Proposal] add provenance document creation support based on in-toto attestations Dec 6, 2021
@developer-guy
Copy link
Member Author

developer-guy commented Feb 8, 2022

maybe we can approach this issue from a different angle, we can use slsa-provenance CLI from philips-labs to generate an SLSA provenance, then we can sign and attach it using cosign under the hood instead of generating it our own in GoReleaser.

or we can use this: slsa-framework/github-actions-demo

cc: @marcofranssen @shibumi @Dentrax

@caarlos0
Copy link
Member

caarlos0 commented Feb 8, 2022

I think we can experiment running the action before running goreleaser, then just adding the file to the release and signing it

@caarlos0
Copy link
Member

caarlos0 commented Feb 8, 2022

scratch that, it needs to run after... so, not sure if we use the action directly or integrate it more properly with goreleaser

maybe its possible to use the signs config for it? 🤔

@SantiagoTorres
Copy link

I think the slsa-provenance type could work (it's still an in-toto type). Let me know if there is anything I can help w/ it

@marcofranssen
Copy link

Happy to have a chat on how we can integrate slsa-provenance with goreleaser.

We are using goreleaser as well for releasing the slsa-provenance-action. "chicken and egg" problem to release our own thing with goreleaser, once the provenance feature is added.

@caarlos0
Copy link
Member

hey @marcofranssen , feel free to ping me on our discord! https://discord.gg/RGEBtg8vQ6

@caarlos0
Copy link
Member

is there someone interested in working on this?

@developer-guy
Copy link
Member Author

There is also another project that can help us. It generates an attestation (based on SLSA) and stores it in a Rekor public transparency log server provided by the sigstore community.

https://github.com/slsa-framework/slsa-github-generator-go

@developer-guy
Copy link
Member Author

@Dentrax, let's give it a try?

@developer-guy
Copy link
Member Author

ping @Dentrax

@developer-guy developer-guy self-assigned this May 24, 2022
@developer-guy
Copy link
Member Author

developer-guy commented May 24, 2022

I'd like to propose the same UX that was being proposed by @wagoodman in his Syft integration to GoReleaser (#2597)

# .goreleaser.yml
provenances:
  -
    # ID of the provenance config, must be unique.
    #
    # Defaults to "default".
    id: foo

    # List of Names/templates of the provenance files created at this step.
    #
    # Available environment variables:
    # - '${artifact}': the path to the artifact that will be provenance generated
    # - '${artifactID}': the ID of the artifact that will be provenance generated
    #
    # Defaults to empty list.
    provenance: 
      - "${artifact}.att"

    # Path to the provenance generator command
    # Source: https://github.com/philips-labs/slsa-provenance-action/releases   
    cmd: slsa-provenance

    # Command line templateable arguments for the command
    # we should supply these also: --digest "${IMAGE_DIGEST}" --tags "${IMAGE_TAGS}
    args: ["generate", "container", "--output-path", "${provenance}", --repository "${artifact}"]

    # Which artifacts to generate provenance
    #
    #   binary:   binaries output from the build stage
    #   container:  reference to the published container image 
    #... there maybe other artifacts that make sense here!
    #
    # Defaults to `container`
    artifacts: container

    # Which environment variables will be supplied to the command
    env:
      - FOO=bar
      - HONK=honkhonk

cc: @marcofranssen @caarlos0

@caarlos0
Copy link
Member

caarlos0 commented Jun 2, 2022

@developer-guy lgtm!

@asraa
Copy link

asraa commented Jun 14, 2022

@developer-guy @caarlos0

cc @laurentsimon

Hey! As mentioned before, we've been creating trusted builders using reuseable workflows to generate slsa provenance. for golang, we modeled our config after goreleaser. The reusable workflow guarantees isolation from the calling workflow (the projects) maintainer's from interfering with the build and provenance generation, something unique to reuseable workflows over actions because env variables and defaults don't propogate to them.

I'm wondering if it's possible to support a goreleaser "reuseable workflow" that can use the same goreleaser binary and config, but guarantees a strong isolation over an action.

Taking a look at https://github.com/slsa-framework/slsa-github-generator/blob/675472104f54a100560e96e8090921390a77cadf/.github/workflows/builder_go_slsa3.yml#L84-L88, the steps of our builder does:

  1. Build the builder
  2. Dry run of the build to resolve variables to use in provenance generation (command, binary name, environment vars, working dir)
  3. Build
  4. Upload the generated binaries
  5. Generate & sign SLSA provenance
  6. Upload assets if needed

If goreleaser supports a dry run for the build, then we could directly substitute the goreleaser build. There may be some flags and environment vars goreleaser may allow that we don't currently allow, but TBD

@developer-guy
Copy link
Member Author

developer-guy commented Oct 22, 2022

I thought that GoReleaser could use these SLSA provenance generators that were out there, such as slsa-framework/slsa-github-generator, philips-labs/slsa-provenance-action, but @asraa gave another idea, and she tell us that IIUC, we could make GoReleaser is a part of its provenance generator for building binaries, that is so interesting, and we should discuss on that @caarlos0

@caarlos0
Copy link
Member

yes, tbh I'm not well versed in all that and don't know how most of it works, so maybe we could chat about it on discord or something (or here too, wherever you prefer 🙏)

@laurentsimon
Copy link
Contributor

Please keep me in the loop as well. I work with @asraa on slsa-framework/slsa-github-generator.

@caarlos0
Copy link
Member

@laurentsimon will probably keep posting here and/or in our discord

@Dentrax
Copy link
Member

Dentrax commented Jan 20, 2023

Has anybody started work on this yet? Maybe we can integrate the slsa-github-generator as a lib.

@caarlos0
Copy link
Member

I don't think anyone is working on it, no, wanna give it a try?

@asraa
Copy link

asraa commented Jan 20, 2023

Has anybody started work on this yet? Maybe we can integrate the slsa-github-generator as a lib.

Hey! Recently @laurentsimon and I have been working on creating an "action wrapper" that reaches SLSA 3, and we thought of GoReleaser Action as the perfect candidate for that.

We are targetting the next quarter or two for GA of it -- it may make sense @Dentrax to integrate with this. If you're interested, we can share how to do that! (It's a lot more lightweight than reconstructing libraries or coding. Just workflow templating)

@laurentsimon
Copy link
Contributor

We can showcase a demo in a few weeks. What's the best way to get in touch? slack?

@caarlos0
Copy link
Member

We can showcase a demo in a few weeks. What's the best way to get in touch? slack?

I'm on discord, I think @Dentrax is too.

https://goreleaser.com/discord

@developer-guy
Copy link
Member Author

count me in !

@developer-guy developer-guy removed their assignment Jan 23, 2023
@asraa
Copy link

asraa commented Jan 27, 2023

hey! we are one step closer. I have a "POC" that performs a goreleaser build and creates Sigstore signed SLSA 3 provenance.

There's obvious missing parts that I didn't do yet:

  • Piping all the possible goreleaser args through the workflow (it's hardcoded with release)
  • Accessing the default github token to actually create the release
  • Attestation to all the subjects produced (I only did the first)
  • Call goreleaser action locally instead of pinned at a version here

Here's the test run: https://github.com/asraa/slsa-on-github-test/actions/runs/4017434808 producing the goreleaser artifacts in goreleaser and the attestations in slsa-attestations-*. I'm cleaning this up as we go.

Here is the SLSA 3 goreleaser workflow (that wraps the action): https://github.com/asraa/slsa-on-github/blob/main/.github/workflows/goreleaser_slsa3.yml

Let's chat! I'll definitely need some help writing docs, testing, making examples.

@laurentsimon
Copy link
Contributor

laurentsimon commented Jan 27, 2023

@caarlos0
Copy link
Member

caarlos0 commented Jan 7, 2024

gently pint: what's the state of this one?

@laurentsimon
Copy link
Contributor

We have done an integration for jreleaser, see https://slsa.dev/blog/2023/08/bring-your-own-builder-github and https://github.com/jreleaser/release-action/tree/v1.1.0-java.
We're happy to help you integrate, unless you prefer keeping only this option https://goreleaser.com/blog/slsa-generation-for-your-artifacts/
/cc @aalmiray

@caarlos0
Copy link
Member

caarlos0 commented Jan 9, 2024

hey @laurentsimon

Yeah, seems like jreleaser's slsa integration is easier to use than the example from that blog post... I think it would be nice to do something similar...

cc/ @developer-guy wdyt?

@laurentsimon
Copy link
Contributor

laurentsimon commented Jan 13, 2024

Note that are are also security considerations:

  1. Using BYOB, we can technically record all dependencies in the attestation, reaching L4 level. We don't support it yet but it's a feature we can add in the future
  2. The blog post https://goreleaser.com/blog/slsa-generation-for-your-artifacts/ uses the generic generator, which is only able to attest to the workflow+inputs used by the build, but not the exact runner. On the contrary, BYOB (like our own Go builder) can attest to the runner to avoid situations like https://johnstawinski.com/2024/01/11/playing-with-fire-how-we-executed-a-critical-supply-chain-attack-on-pytorch/. That's simply because in BYOB we control the runner where the build run, so we can ensure it's GitHub-hosted

@developer-guy
Copy link
Member Author

great resources, thanks for sharing!

@laurentsimon
Copy link
Contributor

np. To be fair on the runner, we have slsa-framework/slsa-github-generator#1868 which may fix it :)

@laurentsimon
Copy link
Contributor

Will any of you attend KubeCon Paris?

@laurentsimon
Copy link
Contributor

ouch, I did not see the thumb up :/ Anyone attending OSS@NA?

@adityasaky
Copy link

I'll be there, as will some other in-toto/attestation folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants