Skip to content

Commit ebc603c

Browse files
committed
Add sigstore
1 parent fda8464 commit ebc603c

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

.github/workflows/docker-build-push.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ on:
88
- cron: "0 0 * * 0"
99
workflow_dispatch:
1010

11-
permissions: {}
11+
permissions:
12+
# Required by sigstore
13+
id-token: write
1214

1315
jobs:
1416
build:
@@ -48,3 +50,18 @@ jobs:
4850
sbom: true
4951
tags: ${{ steps.meta.outputs.tags }}
5052
labels: ${{ steps.meta.outputs.labels }}
53+
- name: Install cosign
54+
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
55+
- name: Sign the Docker image
56+
working-directory: ${{ env.IMAGE }}
57+
env:
58+
DIGEST: ${{ steps.build.outputs.digest }}
59+
TAGS: ${{ steps.meta.outputs.tags }}
60+
shell: bash
61+
run: |
62+
images=""
63+
for tag in ${TAGS}; do
64+
images+="${tag}@${DIGEST} "
65+
done
66+
# shellcheck disable=SC2086
67+
cosign sign --recursive --yes ${images}

.github/workflows/docker-release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55
release:
66
types: [published]
77

8-
permissions: {}
8+
permissions:
9+
# Required by sigstore
10+
id-token: write
911

1012
jobs:
1113
release:
@@ -36,6 +38,7 @@ jobs:
3638
username: ${{ secrets.DOCKERHUB_USERNAME }}
3739
password: ${{ secrets.DOCKERHUB_TOKEN }}
3840
- uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6.14.0
41+
id: build
3942
with:
4043
context: ${{ env.REPOSITORY }}
4144
platforms: linux/amd64,linux/arm64
@@ -44,3 +47,18 @@ jobs:
4447
sbom: true
4548
tags: ${{ steps.meta.outputs.tags }}
4649
labels: ${{ steps.meta.outputs.labels }}
50+
- name: Install cosign
51+
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
52+
- name: Sign the Docker image
53+
working-directory: ${{ env.REPOSITORY }}
54+
env:
55+
DIGEST: ${{ steps.build.outputs.digest }}
56+
TAGS: ${{ steps.meta.outputs.tags }}
57+
shell: bash
58+
run: |
59+
images=""
60+
for tag in ${TAGS}; do
61+
images+="${tag}@${DIGEST} "
62+
done
63+
# shellcheck disable=SC2086
64+
cosign sign --recursive --yes ${images}

.github/workflows/dockerhub.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ jobs:
2424
- name: Pull the latest ${{ matrix.platform }} image
2525
shell: bash
2626
run: docker pull --platform "${{ matrix.platform }}" "${GITHUB_REPOSITORY_OWNER}/${REPOSITORY}"
27+
- name: Pull the latest ${{ matrix.platform }} image SBOM
28+
shell: bash
29+
run: docker buildx imagetools inspect "${GITHUB_REPOSITORY_OWNER}/${REPOSITORY}" --format "{{ json (index .SBOM \"${{ matrix.platform }}\").SPDX }}"
30+
- name: Install cosign
31+
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
32+
- name: Verify the Docker image signature
33+
shell: bash
34+
run: |
35+
cosign verify "${GITHUB_REPOSITORY_OWNER}/${REPOSITORY}" --certificate-identity-regexp "https://github\.com/${GITHUB_REPOSITORY}/\.github/workflows/.+" --certificate-oidc-issuer 'https://token.actions.githubusercontent.com'

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,37 @@ docker buildx imagetools inspect leplusorg/openid-connect-provider-debugger --fo
253253

254254
Replace `linux/amd64` by the desired platform (`linux/amd64`, `linux/arm64` etc.).
255255

256+
### Sigstore
257+
258+
[Sigstore](https://docs.sigstore.dev) is trying to improve supply
259+
chain security by allowing you to verify the origin of an
260+
artifcat. You can verify that the jar that you use was actually
261+
produced by this repository. This means that if you verify the
262+
signature of the ristretto jar, you can trust the integrity of the
263+
whole supply chain from code source, to CI/CD build, to distribution
264+
on Maven Central or whever you got the jar from.
265+
266+
You can use the following command to verify the latest image using its
267+
sigstore signature attestation:
268+
269+
```bash
270+
cosign verify leplusorg/openid-connect-provider-debugger --certificate-identity-regexp 'https://github\.com/leplusorg/docker-av/\.github/workflows/.+' --certificate-oidc-issuer 'https://token.actions.githubusercontent.com'
271+
```
272+
273+
The output should look something like this:
274+
275+
```text
276+
Verification for index.docker.io/leplusorg/xml:main --
277+
The following checks were performed on each of these signatures:
278+
- The cosign claims were validated
279+
- Existence of the claims in the transparency log was verified offline
280+
- The code-signing certificate was verified using trusted certificate authority certificates
281+
282+
[{"critical":...
283+
```
284+
285+
For instructions on how to install `cosign`, please read this [documentation](https://docs.sigstore.dev/cosign/system_config/installation/).
286+
256287
## Credits
257288

258289
This project is based on NGINX / OpenResty and all the actual OpenID

0 commit comments

Comments
 (0)