Skip to content

Commit 56c8a2e

Browse files
Add Cosign verification
1 parent 5f9d9a5 commit 56c8a2e

File tree

1 file changed

+67
-8
lines changed

1 file changed

+67
-8
lines changed

VERIFY_ATTESTATIONS.md

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
## Using artifact attestations to achieve SLSA v1 Build Level 3
1+
# Using artifact attestations to achieve SLSA v1 Build Level 3
22

33
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.
44

5-
### Verifying artifact attestations built with a reusable workflow
5+
## Verifying release artifacts attestations with GitHub CLI
6+
7+
### Prerequisites
8+
9+
First, install GitHub CLI if you haven't already. See the [installation instructions](https://github.com/cli/cli#installation) for your platform.
10+
11+
### Verifying attestations
612

713
To verify artifact attestations generated during the build process, use the `gh attestation verify` command from the GitHub CLI.
814

@@ -15,7 +21,7 @@ The `gh attestation verify` command requires either `--owner` or `--repo` flags
1521
> Not all artifacts may have attestations generated for them. Please check the [attestations](https://github.com/integrations/terraform-provider-github/attestations) page for this repository to see which artifacts have attestations available.
1622
1723
> [!CAUTION]
18-
> The attestations are available only for releases created since the version `v6.9.0` of this project.
24+
> The attestations are available only for the releases created since the version `v6.9.0` of this project.
1925
2026
Download the release artifacts first:
2127

@@ -26,7 +32,8 @@ gh release download vX.Y.Z --repo integrations/terraform-provider-github -p "*.z
2632
To verify the artifact attestations for this project, you can run the following command:
2733

2834
```bash
29-
gh attestation verify --repo integrations/terraform-provider-github terraform-provider-github_X.Y.Z_darwin_amd64.zip
35+
gh attestation verify --repo integrations/terraform-provider-github \
36+
terraform-provider-github_X.Y.Z_darwin_amd64.zip
3037
```
3138

3239
### Using optional flags
@@ -36,13 +43,65 @@ The `gh attestation verify` command supports additional flags for more specific
3643
Use the `--signer-repo` flag to specify the repository:
3744

3845
```bash
39-
gh attestation verify --owner integrations --signer-repo integrations/terraform-provider-github \
40-
terraform-provider-github_X.Y.Z_darwin_amd64.zip
46+
gh attestation verify --owner integrations --signer-repo \
47+
integrations/terraform-provider-github \
48+
terraform-provider-github_X.Y.Z_darwin_amd64.zip
4149
```
4250

4351
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.
4452

4553
```bash
46-
gh attestation verify --owner integrations --signer-workflow integrations/terraform-provider-github/.github/workflows/release.yml \
47-
terraform-provider-github_X.Y.Z_darwin_amd64.zip
54+
gh attestation verify --owner integrations --signer-workflow \
55+
integrations/terraform-provider-github/.github/workflows/release.yaml \
56+
terraform-provider-github_X.Y.Z_darwin_amd64.zip
57+
```
58+
59+
## Verifying release artifacts with Cosign
60+
61+
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.
62+
63+
### Prerequisites
64+
65+
First, install Cosign if you haven't already. See the [installation instructions](https://docs.sigstore.dev/cosign/system_config/installation/) for your platform.
66+
67+
### Verify checksums file
68+
69+
> [!NOTE]
70+
> Make sure to replace X.Y.Z with the actual release tag you want to verify.
71+
72+
Download the checksums file and its signature bundle:
73+
74+
```bash
75+
gh release download vX.Y.Z --repo integrations/terraform-provider-github \
76+
-p "terraform-provider-github_X.Y.Z_SHA256SUMS" \
77+
-p "terraform-provider-github_X.Y.Z_SHA256SUMS.sbom.json.bundle"
4878
```
79+
80+
Verify the checksums file signature:
81+
82+
```bash
83+
cosign verify-blob \
84+
--bundle terraform-provider-github_X.Y.Z_SHA256SUMS.sbom.json.bundle \
85+
--certificate-identity-regexp "^https://github.com/integrations/terraform-provider-github" \
86+
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
87+
terraform-provider-github_X.Y.Z_SHA256SUMS
88+
```
89+
90+
### Verify artifact checksums
91+
92+
After verifying the checksums file, verify your downloaded artifacts match the checksums:
93+
94+
Download the artifact you want to verify:
95+
96+
```bash
97+
gh release download vX.Y.Z --repo integrations/terraform-provider-github \
98+
-p "terraform-provider-github_X.Y.Z_darwin_amd64.zip"
99+
```
100+
101+
Verify the checksum:
102+
103+
```bash
104+
shasum -a 256 -c terraform-provider-github_X.Y.Z_SHA256SUMS --ignore-missing
105+
```
106+
107+
This will verify that your downloaded artifact matches the signed checksum, confirming its integrity and authenticity.

0 commit comments

Comments
 (0)