Skip to content

Commit c992315

Browse files
Add Cosign verification
Signed-off-by: Viacheslav Kudinov <[email protected]>
1 parent 5f9d9a5 commit c992315

1 file changed

Lines changed: 64 additions & 8 deletions

File tree

VERIFY_ATTESTATIONS.md

Lines changed: 64 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,62 @@ 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+
Download the checksums file and its signature bundle:
70+
71+
```bash
72+
gh release download vX.Y.Z --repo integrations/terraform-provider-github \
73+
-p "terraform-provider-github_X.Y.Z_SHA256SUMS" \
74+
-p "terraform-provider-github_X.Y.Z_SHA256SUMS.sbom.json.bundle"
4875
```
76+
77+
Verify the checksums file signature:
78+
79+
```bash
80+
cosign verify-blob \
81+
--bundle terraform-provider-github_X.Y.Z_SHA256SUMS.sbom.json.bundle \
82+
--certificate-identity-regexp "^https://github.com/integrations/terraform-provider-github" \
83+
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
84+
terraform-provider-github_X.Y.Z_SHA256SUMS
85+
```
86+
87+
### Verify artifact checksums
88+
89+
After verifying the checksums file, verify your downloaded artifacts match the checksums:
90+
91+
Download the artifact you want to verify:
92+
93+
```bash
94+
gh release download vX.Y.Z --repo integrations/terraform-provider-github \
95+
-p "terraform-provider-github_X.Y.Z_darwin_amd64.zip"
96+
```
97+
98+
Verify the checksum:
99+
100+
```bash
101+
shasum -a 256 -c terraform-provider-github_X.Y.Z_SHA256SUMS --ignore-missing
102+
```
103+
104+
This will verify that your downloaded artifact matches the signed checksum, confirming its integrity and authenticity.

0 commit comments

Comments
 (0)