-
Notifications
You must be signed in to change notification settings - Fork 961
chore(actions): Add doc how to verify GitHub Attestations with GitHub cli and verify release artifacts with Cosign #2846
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
stevehipwell
merged 29 commits into
integrations:main
from
ViacheslavKudinov:maintenance/add-attestation
Feb 2, 2026
Merged
Changes from 18 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
4d2ad53
Add GH attestation on release
ViacheslavKudinov aced599
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov b5c9194
Merge branch 'main' into maintenance/add-attestation
8ce6580
Add information that attestations are available sine v6.9.0
ViacheslavKudinov 5f9d9a5
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov 00de37c
Add Cosign verification
ViacheslavKudinov d032e0a
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 199e2e6
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 3e4e256
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov a03b298
Use ${version} in all the commands
ViacheslavKudinov c9bb5b6
Add Cosign attestation verification
ViacheslavKudinov dd90136
Use artifact variable
ViacheslavKudinov 93c9762
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov 78de0b3
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov b1d278c
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov a1082cb
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 58a7f7e
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 1c5420e
Update headings and blockquote
ViacheslavKudinov c6d03e4
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov b30fff1
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 3cd061e
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 3a3fd17
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov c2010ac
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 8184730
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 188c567
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 9fb5298
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 329ea41
Update VERIFY_ATTESTATIONS.md
ViacheslavKudinov 04783a6
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov bbad219
Merge branch 'main' into maintenance/add-attestation
ViacheslavKudinov 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 |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| # Using artifact Attestations to achieve SLSA v1 Build Level 3 | ||
|
|
||
| This project started to use GitHub Action to create attestations for the release artifacts. Building software with artifact attestation streamlines supply chain security and helps us achieve [SLSA](https://slsa.dev/) v1.0 Build Level 3 for this project. | ||
|
|
||
| > [!NOTE] | ||
| > Not all artifacts may have attestations generated for them. Please check the [repository attestations](https://github.com/integrations/terraform-provider-github/attestations) to see which artifacts have attestations available. | ||
| > | ||
| > Attestations are only available for releases from `v6.9.0`. | ||
|
|
||
| ## Verifying release artifacts Attestations with GitHub CLI | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Prerequisites | ||
|
|
||
| First, install GitHub CLI if you haven't already. See the [installation instructions](https://github.com/cli/cli#installation) for your platform. | ||
|
|
||
| ### Verifying Attestations | ||
|
|
||
| To verify artifact attestations generated during the build process, use the `gh attestation verify` command from the GitHub CLI. | ||
|
|
||
| The `gh attestation verify` command requires either `--owner` or `--repo` flags to be used with it. | ||
|
|
||
| > [!NOTE] | ||
| > Make sure to replace x.y.z with the actual release tag you want to verify. | ||
| > Replace artifact name with the actual artifact you want to verify. | ||
|
|
||
| Download the release artifacts first: | ||
|
|
||
| ```bash | ||
| version="x.y.z" | ||
| artifact="terraform-provider-github_${version}_darwin_amd64.zip" | ||
|
|
||
| gh release download "v${version}" --repo integrations/terraform-provider-github -p "*.zip" --clobber | ||
| ``` | ||
|
|
||
| To verify the artifact attestations for this project, you can run the following command: | ||
|
|
||
| ```bash | ||
| gh attestation verify --repo integrations/terraform-provider-github --source-ref "refs/tags/v${version}"\ | ||
| --signer-workflow integrations/terraform-provider-github/.github/workflows/release.yaml@refs/tags/v${version} \ | ||
| "$artifact" | ||
| ``` | ||
|
|
||
| ### Verifying all artifacts at once | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| Alternatively, you can verify all downloaded artifacts with a loop that provides individual status reporting: | ||
|
|
||
| ```bash | ||
| for artifact in terraform-provider-github_${version}_*.zip; do | ||
| echo "Verifying: $artifact" | ||
| gh attestation verify --repo integrations/terraform-provider-github --source-ref "refs/tags/v${version}" \ | ||
| --signer-workflow integrations/terraform-provider-github/.github/workflows/release.yaml@refs/tags/v${version} \ | ||
| "$artifact" && echo "✓ Verified" || echo "✗ Failed" | ||
| done | ||
| ``` | ||
|
|
||
| ### Using optional flags | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| The `gh attestation verify` command supports additional flags for more specific verification: | ||
|
|
||
| Use the `--signer-repo` flag to specify the repository: | ||
|
|
||
| ```bash | ||
| gh attestation verify --owner integrations --signer-repo \ | ||
| integrations/terraform-provider-github \ | ||
| "$artifact" | ||
| ``` | ||
|
|
||
| If you would like to require an artifact attestation to be signed with a specific workflow, use the `--signer-workflow` flag to indicate the workflow file that should be used. | ||
|
|
||
| ```bash | ||
| gh attestation verify --owner integrations --signer-workflow \ | ||
| integrations/terraform-provider-github/.github/workflows/release.yaml@refs/tags/v${version} \ | ||
| "$artifact" | ||
| ``` | ||
|
|
||
| ## Verifying checksums file signature with Cosign and checking artifact integrity | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| > [!NOTE] | ||
| > Not all artifacts may have attestations generated for them. Please check the [repository attestations](https://github.com/integrations/terraform-provider-github/attestations) to see which artifacts have attestations available. | ||
| > | ||
| > Attestations are only available for releases from `v6.9.0`. | ||
|
|
||
| In addition to artifact attestations, you can verify release artifacts using [Cosign](https://docs.sigstore.dev/cosign/overview/). Cosign is a tool for signing and verifying software artifacts and container images. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| First, install Cosign if you haven't already. See the [installation instructions](https://docs.sigstore.dev/cosign/system_config/installation/) for your platform. | ||
|
|
||
| ### Verify checksums file | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| Download the checksums file and its signature bundle: | ||
|
|
||
| ```bash | ||
| gh release download v${version} --repo integrations/terraform-provider-github \ | ||
| -p "terraform-provider-github_${version}_SHA256SUMS" \ | ||
| -p "terraform-provider-github_${version}_SHA256SUMS.sbom.json.bundle" --clobber | ||
| ``` | ||
|
|
||
| Verify the checksums file signature: | ||
|
|
||
| ```bash | ||
| cosign verify-blob \ | ||
| --bundle "terraform-provider-github_${version}_SHA256SUMS.sbom.json.bundle" \ | ||
| --certificate-oidc-issuer https://token.actions.githubusercontent.com \ | ||
| --certificate-identity "https://github.com/integrations/terraform-provider-github/.github/workflows/release.yaml@refs/tags/v${version}" \ | ||
| "terraform-provider-github_${version}_SHA256SUMS" | ||
| ``` | ||
|
|
||
| ### Verify artifact checksums | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| After verifying the checksums file, verify your downloaded artifacts match the checksums: | ||
|
|
||
| Download the artifact you want to verify: | ||
|
|
||
| ```bash | ||
| artifact="terraform-provider-github_${version}_darwin_amd64.zip" | ||
| gh release download v${version} --repo integrations/terraform-provider-github \ | ||
| -p "$artifact" --clobber | ||
| ``` | ||
|
|
||
| Verify the checksum: | ||
|
|
||
| ```bash | ||
| shasum -a 256 -c terraform-provider-github_${version}_SHA256SUMS --ignore-missing | ||
| ``` | ||
|
|
||
| This will verify that your downloaded artifact matches the signed checksum, confirming its integrity and authenticity. | ||
|
|
||
| ## Verifying SLSA Provenance Attestations with Cosign | ||
|
|
||
| In addition to using the GitHub CLI, you can verify SLSA provenance attestations using Cosign by downloading the attestation and verifying it against your local artifact. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. Install `cosign` for verifying attestations. See the [installation instructions](https://docs.sigstore.dev/cosign/system_config/installation/). | ||
| 2. Install `gh` (GitHub CLI) if you haven't already. See the [installation instructions](https://github.com/cli/cli#installation). | ||
|
|
||
| ### Download and verify Attestation | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| > [!NOTE] | ||
| > Make sure to replace x.y.z with the actual release tag you want to verify. | ||
| > Replace artifact name with the actual artifact you want to verify. | ||
|
|
||
| > [!NOTE] | ||
| > Not all artifacts may have attestations generated for them. Please check the [repository attestations](https://github.com/integrations/terraform-provider-github/attestations) to see which artifacts have attestations available. | ||
| > | ||
| > Attestations are only available for releases from `v6.9.0`. | ||
|
|
||
| First, download the artifact you want to verify: | ||
|
|
||
| ```bash | ||
| version="x.y.z" | ||
| artifact="terraform-provider-github_${version}_darwin_amd64.zip" | ||
|
|
||
| gh release download "v${version}" --repo integrations/terraform-provider-github \ | ||
| -p "$artifact" --clobber | ||
| ``` | ||
|
|
||
| Then, download the attestation associated with the artifact: | ||
|
|
||
| ```bash | ||
| gh attestation download "$artifact" \ | ||
| --repo integrations/terraform-provider-github | ||
| ``` | ||
|
|
||
| This will create a file named `sha256:[digest].jsonl` in the current directory. | ||
|
|
||
| Verify the attestation using Cosign: | ||
|
|
||
| ```bash | ||
| # Calculate the digest and verify using the specific bundle file | ||
| digest=$(shasum -a 256 "$artifact" | awk '{ print $1 }') | ||
| cosign verify-blob-attestation \ | ||
| --bundle "sha256:${digest}.jsonl" \ | ||
| --new-bundle-format \ | ||
| --certificate-oidc-issuer https://token.actions.githubusercontent.com \ | ||
| --certificate-identity "https://github.com/integrations/terraform-provider-github/.github/workflows/release.yaml@refs/tags/v${version}" \ | ||
| "$artifact" | ||
| ``` | ||
|
|
||
| A successful verification will output `Verified OK`, confirming that the artifact was built by the trusted GitHub Actions workflow and its provenance is securely recorded. | ||
|
|
||
| ### Verifying all release artifacts | ||
|
ViacheslavKudinov marked this conversation as resolved.
Outdated
|
||
|
|
||
| To verify all release artifacts for a specific version: | ||
|
|
||
| ```bash | ||
| version="x.y.z" | ||
|
|
||
| # Download all release artifacts | ||
| gh release download "v${version}" --repo integrations/terraform-provider-github -p "*.zip" --clobber | ||
|
|
||
| # Download attestations for all artifacts | ||
| for artifact in terraform-provider-github_${version}_*.zip; do | ||
| gh attestation download "$artifact" --repo integrations/terraform-provider-github | ||
| done | ||
|
|
||
| # Verify all artifacts using specific digest-based bundle files | ||
| for artifact in terraform-provider-github_${version}_*.zip; do | ||
| echo "Verifying: $artifact" | ||
| digest=$(shasum -a 256 "$artifact" | awk '{ print $1 }') | ||
| cosign verify-blob-attestation \ | ||
| --bundle "sha256:${digest}.jsonl" \ | ||
| --new-bundle-format \ | ||
| --certificate-oidc-issuer https://token.actions.githubusercontent.com \ | ||
| --certificate-identity "https://github.com/integrations/terraform-provider-github/.github/workflows/release.yaml@refs/tags/v${version}" \ | ||
| "$artifact" > /dev/null && echo "✓ Verified" || echo "✗ Failed" | ||
| done | ||
| ``` | ||
|
|
||
| This approach calculates the digest for each artifact and uses the corresponding specific bundle file, ensuring each artifact is verified against its own attestation. | ||
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.