1111 required : false
1212 type : boolean
1313 default : true
14+
15+ permissions : read-all
16+
1417env :
1518 GO_VERSION : 1.18.4
19+
1620jobs :
1721 build :
1822 outputs :
6872 release :
6973 needs : [build, provenance]
7074 runs-on : ubuntu-latest
75+ permissions :
76+ contents : write
7177 steps :
7278 # Download binaries and license.
7379 - uses : actions/download-artifact@v3
@@ -77,11 +83,45 @@ jobs:
7783 - uses : actions/download-artifact@v3
7884 with :
7985 name : " ${{ needs.provenance.outputs.attestation-name }}"
80- # Verify binaries if dry run
86+ # Verify binaries.
8187 - name : Verify binaries
82- if : ' inputs.dry-run'
88+ env :
89+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
90+ PROVENANCE : " ${{ needs.provenance.outputs.attestation-name }}"
8391 run : |
84- echo TODO: verify with slsa-verifier
92+ set -euo pipefail
93+
94+ # Download the verifier. This will be replaced by the GHA.
95+ gh -R slsa-framework/slsa-verifier release download v1.2.0 -p "slsa-verifier-linux-amd64"
96+
97+ # Note: see https://github.com/slsa-framework/slsa-verifier/blob/main/SHA256SUM.md
98+ COMPUTED_HASH=$(sha256sum slsa-verifier-linux-amd64 | cut -d ' ' -f1)
99+ EXPECTED_HASH="37db23392c7918bb4e243cdb097ed5f9d14b9b965dc1905b25bc2d1c0c91bf3d"
100+ if [[ "$EXPECTED_HASH" != "$COMPUTED_HASH" ]];then
101+ echo "error: expected $EXPECTED_HASH, computed $COMPUTED_HASH"
102+ exit 1
103+ fi
104+ chmod ug+x slsa-verifier-linux-amd64
105+
106+ # Verify all files, except LICENSE, .sha256 and checksums.txt files.
107+ rm LICENSE *.sha256 checksums.txt
108+ for f in *;
109+ do
110+ if [[ "$f" == "attestation.intoto.jsonl" ]] || [[ "$f" == "slsa-verifier-linux-amd64" ]]; then
111+ continue
112+ fi
113+
114+ echo "verifying $f"
115+ ./slsa-verifier-linux-amd64 -artifact-path "$f" \
116+ -provenance "$PROVENANCE" \
117+ -source "github.com/$GITHUB_REPOSITORY" \
118+ -branch v2
119+
120+ done
121+
122+ # The slsa verifier is not part of the project.
123+ rm ./slsa-verifier-linux-amd64
124+
85125 # Upload to release.
86126 - uses : ncipollo/release-action@v1
87127 if : ' ! inputs.dry-run'
0 commit comments