-
Notifications
You must be signed in to change notification settings - Fork 9
image signing and provenance generation #91
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
Merged
JamesLaverack
merged 1 commit into
jetstack:main
from
developer-guy:feature/container-image-signing
May 23, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,13 @@ env: | |
| jobs: | ||
| paranoia-inception: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| image: ${{ steps.build-and-push.outputs.image }} | ||
| digest: ${{ steps.build-and-push.outputs.digest }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write # for creating OIDC tokens for signing. | ||
| steps: | ||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
|
|
@@ -32,6 +36,14 @@ jobs: | |
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| # Install the cosign tool except on PR | ||
| # https://github.com/sigstore/cosign-installer | ||
| - name: Install cosign | ||
| uses: sigstore/cosign-installer@204a51a57a74d190b284a0ce69b44bc37201f343 #v3.0.3 | ||
| with: | ||
| cosign-release: 'v2.0.2' | ||
|
|
||
|
|
||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea | ||
|
|
@@ -57,6 +69,7 @@ jobs: | |
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v3 | ||
| id: build-and-push | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
|
|
@@ -65,3 +78,33 @@ jobs: | |
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| # Sign the resulting Docker image digest except on PRs. | ||
| # This will only write to the public Rekor transparency log when the Docker | ||
| # repository is public to avoid leaking data. If you would like to publish | ||
| # transparency data even for private images, pass --force to cosign below. | ||
| # https://github.com/sigstore/cosign | ||
| - name: Sign the published Docker image | ||
| # This step uses the identity token to provision an ephemeral certificate | ||
| # against the sigstore community Fulcio instance. | ||
| env: | ||
| TAGS: ${{ steps.meta.outputs.tags }} | ||
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
| run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | ||
|
|
||
| provenance-for-images: | ||
developer-guy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| needs: [paranoia-inception] | ||
| permissions: | ||
| actions: read # for detecting the Github Actions environment. | ||
| id-token: write # for creating OIDC tokens for signing. | ||
| packages: write # for uploading attestations. | ||
| uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.6.0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: you can use https://github.com/slsa-framework/slsa-verifier to verify SLSA provenance (slsa.dev), both for containers and binaries. You may add a section in your README to help users with verification |
||
| with: | ||
| image: ghcr.io/${{ github.repository }} | ||
| # The image digest is used to prevent TOCTOU issues. | ||
| # This is an output of the docker/build-push-action | ||
| # See: https://github.com/slsa-framework/slsa-verifier#toctou-attacks | ||
| digest: ${{ needs.paranoia-inception.outputs.digest }} | ||
| registry-username: ${{ github.actor }} | ||
| secrets: | ||
| registry-password: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.