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: Ensure SLSA Lvl 3 #904

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

ci: Ensure SLSA Lvl 3 #904

wants to merge 11 commits into from

Conversation

viccuad
Copy link
Member

@viccuad viccuad commented Oct 4, 2024

Description

Fix #898.

Adapted the work already done by @jvanz from kubewarden/audit-scanner#387 (hence, set @jvanz as Co-authored-by).

Test

Tested by tagging on my fork as v1.18.0-viccuad.
See:
https://github.com/viccuad/kubewarden-controller/actions/runs/11294623076 (release only fails in the last bot pr step)
https://github.com/viccuad/kubewarden-controller/releases/tag/v1.18.0-viccuad7

Additional Information

Tradeoff

Potential improvement

@viccuad viccuad requested a review from a team as a code owner October 4, 2024 11:10
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.53%. Comparing base (dfeb8e5) to head (08758a8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #904   +/-   ##
=======================================
  Coverage   70.53%   70.53%           
=======================================
  Files          30       30           
  Lines        2559     2559           
=======================================
  Hits         1805     1805           
  Misses        584      584           
  Partials      170      170           
Flag Coverage Δ
integration-tests 60.31% <ø> (ø)
unit-tests 39.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@viccuad viccuad marked this pull request as draft October 4, 2024 12:31
@viccuad viccuad force-pushed the slsa branch 5 times, most recently from 7a8109e to 30fba55 Compare October 8, 2024 10:30
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
@viccuad viccuad marked this pull request as ready for review October 8, 2024 11:00
@viccuad viccuad self-assigned this Oct 8, 2024
README.md Outdated Show resolved Hide resolved

cosign verify \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--certificate-identity-regexp="https://github.com/${{github.repository_owner}}/kubewarden-controller*" \
Copy link

Choose a reason for hiding this comment

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

Please fully qualify the identity as per this comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied.

README.md Outdated
[release assets](https://github.com/kubewarden/kubewarden-controller/releases)
```shell
cosign verify-blob --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--certificate-identity-regexp="https://github.com/kubewarden/kubewarden-controller*" \
Copy link

Choose a reason for hiding this comment

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

This example needs to be fully qualified, otherwise users may be checking against the wrong identity.

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied.

README.md Outdated

```shell
cosign verify --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--certificate-identity-regexp="https://github.com/kubewarden/kubewarden-controller*" \
Copy link

Choose a reason for hiding this comment

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

ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied.

README.md Outdated
}

cosign verify --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--certificate-identity-regexp="https://github.com/kubewarden/kubewarden-controller*" \
Copy link

Choose a reason for hiding this comment

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

Ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
@viccuad viccuad force-pushed the slsa branch 2 times, most recently from efac9fe to fe1f8c1 Compare October 9, 2024 12:22
Copy link
Contributor

@jhkrug jhkrug left a comment

Choose a reason for hiding this comment

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

Some minor suggestions for consideration.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@viccuad
Copy link
Member Author

viccuad commented Oct 9, 2024

Applied suggestions and rebased, as it was easier to keep the Co-authored-by. Sorry for the inconvenience.
Now the cosign verify use the specific regexp matching the workflow, and the workflow generates a checksum.txt of the files and signs only that file.

Comment on lines 53 to 61
- name: Sign attestation manifest
run: |
cosign sign --yes \
ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.ATTESTATION_MANIFEST_DIGEST}}

cosign verify \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--certificate-identity-regexp="https://github.com/${{github.repository_owner}}/kubewarden-controller/.github/workflows/attestation.yml@${{ github.ref }}" \
ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.ATTESTATION_MANIFEST_DIGEST}}
Copy link
Member

Choose a reason for hiding this comment

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

I've removed this signing from the audit-scanner and policy-server PR as suggested by @pjbgf

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

Comment on lines 87 to 97
- name: Sign SBOM layer
run: |
cosign sign --yes \
ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.SBOM_DIGEST}}

- name: Verify SBOM layer
run: |
cosign verify \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
--certificate-identity-regexp="https://github.com/${{github.repository_owner}}/kubewarden-controller/.github/workflows/attestation.yml@${{ github.ref }}" \
ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.SBOM_DIGEST}}
Copy link
Member

Choose a reason for hiding this comment

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

I've removed this signing from the audit-scanner and policy-server PR as suggested by @pjbgf

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

Comment on lines 75 to 77
- name: Sign container image
run: |
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to run this step only if the container image is pushed to the repository. See the previous step building the container image. It has this if as well.

Suggested change
- name: Sign container image
run: |
- name: Sign container image
if: ${{ inputs.push-image }}
run: |

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

viccuad and others added 2 commits October 11, 2024 16:57
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Co-authored-by: José Guilherme Vanz <[email protected]>
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Co-authored-by: José Guilherme Vanz <[email protected]>
viccuad and others added 6 commits October 11, 2024 16:57
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Co-authored-by: José Guilherme Vanz <[email protected]>
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Co-authored-by: John Krug <[email protected]>
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Signed-off-by: Víctor Cuadrado Juan <[email protected]>
We are not making use of a regexp anymore and provide fully qualified
identities.

Signed-off-by: Víctor Cuadrado Juan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pending review
Development

Successfully merging this pull request may close these issues.

Ensure SLSA Lvl 3 in kubewarden-controller
4 participants