Skip to content

Commit 00de37c

Browse files
Add Cosign verification
1 parent 5f9d9a5 commit 00de37c

File tree

1 file changed

+78
-13
lines changed

1 file changed

+78
-13
lines changed

VERIFY_ATTESTATIONS.md

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
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+
> [!WARNING]
8+
> 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.
9+
10+
> [!CAUTION]
11+
> The attestations are available only for the releases created since the version `v6.9.0` of this project.
12+
13+
### Prerequisites
14+
15+
First, install GitHub CLI if you haven't already. See the [installation instructions](https://github.com/cli/cli#installation) for your platform.
16+
17+
### Verifying attestations
618

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

@@ -11,12 +23,6 @@ The `gh attestation verify` command requires either `--owner` or `--repo` flags
1123
> [!NOTE]
1224
> Make sure to replace X.Y.Z with the actual release tag you want to verify.
1325
14-
> [!WARNING]
15-
> 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.
16-
17-
> [!CAUTION]
18-
> The attestations are available only for releases created since the version `v6.9.0` of this project.
19-
2026
Download the release artifacts first:
2127

2228
```bash
@@ -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,71 @@ 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+
> [!WARNING]
62+
> Not all the releases may have Cosign signature for the checksum files.
63+
64+
> [!CAUTION]
65+
> The Cosign signatures are available only for the releases created since the version `v6.9.0` of this project.
66+
67+
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.
68+
69+
### Prerequisites
70+
71+
First, install Cosign if you haven't already. See the [installation instructions](https://docs.sigstore.dev/cosign/system_config/installation/) for your platform.
72+
73+
### Verify checksums file
74+
75+
> [!NOTE]
76+
> Make sure to replace X.Y.Z with the actual release tag you want to verify.
77+
78+
Download the checksums file and its signature bundle:
79+
80+
```bash
81+
gh release download vX.Y.Z --repo integrations/terraform-provider-github \
82+
-p "terraform-provider-github_X.Y.Z_SHA256SUMS" \
83+
-p "terraform-provider-github_X.Y.Z_SHA256SUMS.sbom.json.bundle"
84+
```
85+
86+
Verify the checksums file signature:
87+
88+
```bash
89+
cosign verify-blob \
90+
--bundle terraform-provider-github_X.Y.Z_SHA256SUMS.sbom.json.bundle \
91+
--certificate-identity-regexp "^https://github.com/integrations/terraform-provider-github" \
92+
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
93+
terraform-provider-github_X.Y.Z_SHA256SUMS
4894
```
95+
96+
### Verify artifact checksums
97+
98+
After verifying the checksums file, verify your downloaded artifacts match the checksums:
99+
100+
Download the artifact you want to verify:
101+
102+
```bash
103+
gh release download vX.Y.Z --repo integrations/terraform-provider-github \
104+
-p "terraform-provider-github_X.Y.Z_darwin_amd64.zip"
105+
```
106+
107+
Verify the checksum:
108+
109+
```bash
110+
shasum -a 256 -c terraform-provider-github_X.Y.Z_SHA256SUMS --ignore-missing
111+
```
112+
113+
This will verify that your downloaded artifact matches the signed checksum, confirming its integrity and authenticity.

0 commit comments

Comments
 (0)