Skip to content

Commit ebe45b5

Browse files
committed
Sign Docker images and other artefacts with cosign
1 parent 39de805 commit ebe45b5

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ jobs:
269269
- script-integration-test
270270
- env-var-check
271271
runs-on: ubuntu-24.04
272+
permissions:
273+
packages: write
274+
id-token: write
272275
if: ${{ ! startsWith(github.head_ref, 'dependabot/')}}
273276

274277
steps:
@@ -316,6 +319,9 @@ jobs:
316319
- name: Set up Docker Buildx
317320
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
318321

322+
- name: Install Cosign
323+
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
324+
319325
- name: Login to GitHub Container Registry
320326
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3
321327
with:
@@ -337,6 +343,7 @@ jobs:
337343
type=semver,pattern={{major}}.{{minor}}
338344
339345
- name: Build and push
346+
id: docker-build-push
340347
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
341348
with:
342349
context: .
@@ -345,6 +352,9 @@ jobs:
345352
tags: ${{ steps.docker-meta.outputs.tags }}
346353
labels: ${{ steps.docker-meta.outputs.labels }}
347354

355+
- name: Sign GHCR Image
356+
run: cosign sign --yes "ghcr.io/${{ github.repository }}@${{ steps.docker-build-push.outputs.digest }}"
357+
348358
- name: Release
349359
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2
350360
if: startsWith(github.ref, 'refs/tags/')

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ TORCH interacts with the following components directly:
3434
The reverse proxy allows for integration into a site's multi-server infrastructure and provides a means of serving
3535
the extracted data.
3636

37+
## Verification
38+
39+
For container images, we use cosign to sign images. This allows users to confirm the image was built by the expected CI
40+
pipeline and has not been modified after publication.
41+
```
42+
cosign verify "ghcr.io/medizininformatik-initiative/torch:v1.0.0" \
43+
--certificate-identity-regexp "https://github.com/medizininformatik-initiative/torch.*" \
44+
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
45+
--certificate-github-workflow-ref="refs/tags/v1.0.0" \
46+
-o text
47+
```
48+
The expected output is:
49+
```
50+
Verification for ghcr.io/medizininformatik-initiative/torch:v1.0.0 --
51+
The following checks were performed on each of these signatures:
52+
- The cosign claims were validated
53+
- Existence of the claims in the transparency log was verified offline
54+
- The code-signing certificate was verified using trusted certificate authority certificates
55+
```
56+
This output ensures that the image was build on the GitHub workflow on the repository
57+
`medizininformatik-initiative/torch` and tag `v1.0.0`.
58+
3759
### Cohort Selection
3860

3961
TORCH supports CQL or FHIR Search for the cohort selection part.

0 commit comments

Comments
 (0)