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

ci: Generate and sign provenance information as image layer for SLSA lvl 3 #504

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

viccuad
Copy link
Contributor

@viccuad viccuad commented Oct 10, 2024

Hi, this PR adds provenance information to the policy-reporter image as a layer, effectively raising its SLSA level to 3.
I've tried to be as less invasive as possible when adding this to the GHA workflow. In this PR:

  • ci: Generate and sign provenance info as image layer. Configure docker buildx to generate provenance attestations as explained in https://docs.docker.com/build/metadata/attestations/slsa-provenance.
    Then, sign the provenance attestation layer. For that, find the specific layer digest that corresponds to that provenance attestation, both for linux/amd64 and linux/arm64 architectures, and sign it.

  • ci: Use github.repository_owner instead of hardcoded org. This allows to test the CI workflows in a fork, and to not need push permissions to production OCI registry namespace under ghcr.io/kyverno.

As an example of a GHA run, from my fork:
https://github.com/viccuad/policy-reporter/actions/runs/11270355378/job/31340877023
Resulting ghcr package:
https://github.com/users/viccuad/packages/container/package/policy-reporter

Looking forward to the review! Please tell me if a different approach is desired, I can open a different PR if so. Still, felt it was easier to have the conversation with an approach already.

Configure docker buildx to generate provenance attestations
as explained in
https://docs.docker.com/build/metadata/attestations/slsa-provenance.

Find the specific layer digest that corresponds to that provenance
attestation, both for linux/amd64 and linux/arm64 architectures, and
sign it.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
This allows to test the CI workflows in a fork, and to not need
push permissions to production OCI registry namespace under
ghcr.io/kyverno.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11272002163

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 80.868%

Totals Coverage Status
Change from base Build 11262261137: 0.03%
Covered Lines: 6408
Relevant Lines: 7924

💛 - Coveralls

@fjogeleit
Copy link
Member

thanks for your effort @viccuad, will take a closer look today or tomorrow

@fjogeleit fjogeleit merged commit 8f5e4af into kyverno:main Oct 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants