@@ -17,44 +17,85 @@ It will:
1717
1818## Verifying
1919
20- ### Checksums
20+ Your users will need to know how to verify the artifacts, and this is what this
21+ section is all about.
2122
22- ``` shell
23- wget https://github.com/goreleaser/supply-chain-example/releases/download/v1.3.4/checksums.txt
24- wget https://github.com/goreleaser/example-supply-chain/releases/download/v1.3.4/checksums.txt.sigstore.json
23+ The first thing we need to do, is get the current latest version:
24+
25+ ``` bash
26+ export VERSION=" $( gh release list -L 1 -R goreleaser/example-supply-chain --json=tagName -q ' .[] | .tagName' ) "
27+ ```
28+
29+ Then, we download the ` checksums.txt ` and the signature bundle
30+ (` checksums.txt.sigstore.json ` ) files, and then verify them:
31+
32+ ``` bash
33+ wget https://github.com/goreleaser/example-supply-chain/releases/download/$VERSION /checksums.txt
34+ wget https://github.com/goreleaser/example-supply-chain/releases/download/$VERSION /checksums.txt.sigstore.json
2535cosign verify-blob \
26- --certificate-identity ' https://github.com/goreleaser/example-supply-chain/.github/workflows/release.yml@refs/tags/v1.3.4 ' \
36+ --certificate-identity " https://github.com/goreleaser/example-supply-chain/.github/workflows/release.yml@refs/tags/$VERSION " \
2737 --certificate-oidc-issuer ' https://token.actions.githubusercontent.com' \
28- --bundle checksums.txt.sigstore.json \
38+ --bundle " checksums.txt.sigstore.json" \
2939 ./checksums.txt
3040```
3141
42+ This should succeed - which means that we can from now on verify any artifact
43+ from the release with this checksum file!
44+
3245You can then download any file you want from the release, and verify it with, for example:
3346
34- ``` shell
35- wget https://github.com/goreleaser/example-supply-chain/releases/download/v1.3.4/supply-chain-example_1.3.4_linux_amd64.tar.gz.sbom.json
36- wget https://github.com/goreleaser/example-supply-chain/releases/download/v1.3.4/supply-chain-example_1.3.4_linux_amd64.tar.gz
47+ ``` bash
48+ wget " https://github.com/goreleaser/example-supply-chain/releases/download/$VERSION /supply-chain-example_linux_amd64.tar.gz"
3749sha256sum --ignore-missing -c checksums.txt
3850```
3951
40- And both should say "OK".
52+ Which should, ideally, say "OK".
53+
54+ You can then inspect the SBOM file to see the entire dependency tree of the
55+ binary, check for vulnerable dependencies and whatnot.
4156
42- You can then inspect the ` .sbom ` file to see the entire dependency tree of the binary.
57+ To get the SBOM of an artifact, you can use the same download URL, adding
58+ ` .sbom.json ` to the end of the URL, and we can then check it out with ` grype ` :
4359
44- ### Attestations
60+ ``` bash
61+ wget " https://github.com/goreleaser/example-supply-chain/releases/download/$VERSION /supply-chain-example_linux_amd64.tar.gz.sbom.json"
62+ sha256sum --ignore-missing -c checksums.txt
63+ grype sbom:supply-chain-example_linux_amd64.tar.gz.sbom.json
64+ ```
4565
46- This example also publishes build attestations.
47- You can verify any artifact with:
66+ Finally, we can also use the ` gh ` CLI to verify the attestations:
4867
49- ``` shell
50- gh attestation verify --owner goreleaser * .tar.gz
68+ ``` bash
69+ gh attestation verify \
70+ --owner goreleaser \
71+ * .tar.gz
5172```
5273
53- ### Docker image
74+ Docker images are a bit simpler, you can verify them with cosign
75+ and grype directly, and check the attestations as well.
5476
55- ``` shell
77+ Signature:
78+
79+ ``` bash
5680cosign verify \
57- --certificate-identity ' https://github.com/goreleaser/example-supply-chain/.github/workflows/release.yml@refs/tags/v1.3.4' \
58- --certificate-oidc-issuer ' https://token.actions.githubusercontent.com' \
59- ghcr.io/goreleaser/example-supply-chain:v1.3.4
81+ --certificate-identity " https://github.com/goreleaser/example-supply-chain/.github/workflows/release.yml@refs/tags/$VERSION " \
82+ --certificate-oidc-issuer " https://token.actions.githubusercontent.com" \
83+ " ghcr.io/goreleaser/example-supply-chain:$VERSION "
84+ ```
85+
86+ Vulnerabilities:
87+
88+ ``` bash
89+ grype " docker:ghcr.io/goreleaser/example-supply-chain:$VERSION "
6090```
91+
92+ Attestations:
93+
94+ ``` bash
95+ gh attestation verify \
96+ --owner goreleaser \
97+ " oci://ghcr.io/goreleaser/example-supply-chain:$VERSION "
98+ ```
99+
100+ If all these checks are OK, you have a pretty good indication that everything
101+ is good.
0 commit comments