Skip to content

Commit d64b566

Browse files
authored
Sign checksum with cosign (#4181)
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 964b203 commit d64b566

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jobs:
8787
release-url: ${{ steps.release-notes.outputs.release-url }}
8888
permissions:
8989
contents: write # for lucacome/draft-release and goreleaser/goreleaser-action to manage releases
90+
id-token: write # for goreleaser/goreleaser-action to sign artifacts
9091
steps:
9192
- name: Checkout Repository
9293
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
@@ -100,7 +101,11 @@ jobs:
100101

101102
- name: Download Syft
102103
uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
103-
if: startsWith(github.ref, 'refs/tags/')
104+
if: github.ref_type == 'tag'
105+
106+
- name: Install Cosign
107+
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
108+
if: github.ref_type == 'tag'
104109

105110
- name: Create/Update Draft
106111
uses: lucacome/draft-release@f6dc37dcdf44be100a649b72c62c628776750190 # v0.2.2

.goreleaser.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ blobs:
117117
extra_files:
118118
- glob: ./dist/**.spdx.json
119119

120+
signs:
121+
- cmd: cosign
122+
artifacts: checksum
123+
output: true
124+
certificate: '${artifact}.pem'
125+
args:
126+
- sign-blob
127+
- "--output-signature=${signature}"
128+
- "--output-certificate=${certificate}"
129+
- "${artifact}"
130+
- "--yes"
131+
120132
announce:
121133
slack:
122134
enabled: true

0 commit comments

Comments
 (0)