Skip to content

Commit fcf9764

Browse files
authored
Sign checksum with cosign (#897)
Adds config to sign artifacts. Since the checksum contains the SHAs of the artifacts, signing the checksums is enough to ensure that the artifacts were not modified. GoReleaser uses cosign to sign the artifact and uploads .sig and .pem to the release.
1 parent 9b3ae2c commit fcf9764

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
needs: [vars, unit-tests, njs-unit-tests]
9999
permissions:
100100
contents: write # for goreleaser/goreleaser-action and lucacome/draft-release to create/update releases
101+
id-token: write # for goreleaser/goreleaser-action to sign artifacts
101102
steps:
102103
- name: Checkout Repository
103104
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
@@ -125,6 +126,10 @@ jobs:
125126
uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
126127
if: startsWith(github.ref, 'refs/tags/')
127128

129+
- name: Install Cosign
130+
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
131+
if: startsWith(github.ref, 'refs/tags/')
132+
128133
- name: Build binary
129134
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
130135
with:

.goreleaser.yml

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ blobs:
3232
- provider: azblob
3333
bucket: '{{.Env.AZURE_BUCKET_NAME}}'
3434

35+
signs:
36+
- cmd: cosign
37+
artifacts: checksum
38+
output: true
39+
certificate: '${artifact}.pem'
40+
args:
41+
- sign-blob
42+
- "--output-signature=${signature}"
43+
- "--output-certificate=${certificate}"
44+
- "${artifact}"
45+
- "--yes"
46+
3547
announce:
3648
slack:
3749
enabled: true

0 commit comments

Comments
 (0)