Skip to content

Commit 8747dcc

Browse files
committed
chore: update to cosign v2.0.0. Add argument to make sure you are aware to use keyless signing with PUBLIC tlog
Signed-off-by: Jeroen Knoops <jeroen.knoops@philips.com>
1 parent 3dadf22 commit 8747dcc

File tree

5 files changed

+40
-22
lines changed

5 files changed

+40
-22
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project uses the version of main tool as main version number .
66

77
## [Unreleased]
88

9+
- Cosign version 2.0
10+
- BREAKING when doing KEYLESS signing:
11+
- You need to acknowledge using a PUBLIC Rekor and Fulcio server when doing keyless signing. Set `public_transparancy_log` to `true`. Default is `false`.
12+
13+
## v5.1.0
914
- Remove experimental flag for keyless signing
1015
- Rename arguments to reflect multiple container registries.
1116

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Examples: Using explicit variables
105105

106106
**Optional** Set to `true` when you want to use keyless signing with [SigStore's Rekor and Fulcio](https://blog.sigstore.dev/sigstore-ga-ddd6ba67894d).
107107
**Warning** This is a **PUBLIC** transparancy log, this means you will reveal information about your OCI images publically. **DO NOT USE THIS FOR PRIVATE IMAGES**.
108+
In order to make sure you understand a **PUBLIC** transparancy log is used, you need to set the `public_transparancy_log` argument to `true`.
108109

109110
You can use `KEYLESS` to start using SigStore's Rekor and Fulcio together with GitHub OIDC. When set, you don't need to specify the three COSIGN Arguments.
110111

@@ -235,7 +236,7 @@ Store the content of `cosign.pub`, `cosign.key` and the password in GitHub Secre
235236
Now you can verify the image f.e. `jeroenknoops/test-image:latest`:
236237

237238
```bash
238-
$ cosign verify --key cosign.pub jeroenknoops/test-image:latest
239+
$ cosign verify --insecure-ignore-tlog --key cosign.pub jeroenknoops/test-image:latest
239240
```
240241

241242
You will get a result when the image is valid.
@@ -276,8 +277,7 @@ Now you can verify the image f.e. `jeroenknoops/test-image:latest`:
276277
Keyless siging is still an expermental feature of cosign, so you need to set the flag.
277278

278279
```bash
279-
$ export COSIGN_EXPERIMENTAL=1
280-
$ cosign verify --key cosign.pub jeroenknoops/test-image:latest
280+
$ cosign verify --insecure-ignore-tlog --key cosign.pub jeroenknoops/test-image:latest
281281
```
282282

283283
You will get a result when the image is valid.
@@ -337,7 +337,7 @@ the COSIGN environment variables. (see #sign how to generate the key-pair)
337337
Now you can verify the attestation for a certain docker-repo f.e. `jeroenknoops/test-image:latest`:
338338

339339
```bash
340-
$ cosign verify-attestation --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType=="https://slsa.dev/provenance/v0.2" ) | .'
340+
$ cosign verify-attestation --insecure-ignore-tlog --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType=="https://slsa.dev/provenance/v0.2" ) | .'
341341
```
342342

343343
This is nice, because you can see how and when the image was build, without downloading it!
@@ -393,7 +393,7 @@ the COSIGN environment variables. (see #sign how to generate the key-pair)
393393
Now you can verify the attestation for a certain docker-repo f.e. `jeroenknoops/test-image:latest`:
394394

395395
```bash
396-
$ cosign verify-attestation --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType=="https://spdx.dev/Document" ) | .predicate.Data | fromjson | .'
396+
$ cosign verify-attestation --insecure-ignore-tlog --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType=="https://spdx.dev/Document" ) | .predicate.Data | fromjson | .'
397397
```
398398

399399
#### With SLSA-Provenance and Software Bill of Material (SBOM) attached to Image:
@@ -425,8 +425,8 @@ the COSIGN environment variables. (see #sign how to generate the key-pair)
425425
Now you can verify the attestation for a certain docker-repo f.e. `jeroenknoops/test-image:latest`:
426426

427427
```bash
428-
$ cosign verify-attestation --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType=="https://spdx.dev/Document" ) | .predicate.Data | fromjson | .'
429-
$ cosign verify-attestation --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType=="https://slsa.dev/provenance/v0.2" ) | .'
428+
$ cosign verify-attestation --insecure-ignore-tlog --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType=="https://spdx.dev/Document" ) | .predicate.Data | fromjson | .'
429+
$ cosign verify-attestation --insecure-ignore-tlog --key cosign.pub jeroenknoops/test-image:latest | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType=="https://slsa.dev/provenance/v0.2" ) | .'
430430
```
431431

432432
This is nice, because you can see the SBOM of the image, without downloading it!

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ inputs:
3232
sign:
3333
description: 'Sign image with Cosign. Requires COSIGN environment variables to be set. When used in combination with slsa-provenance / sbom it will also attach the results to the image.'
3434
required: false
35+
public_transparancy_log:
36+
description: 'Use PUBLIC Fulcio and Rekor services to store information'
37+
required: true
38+
default: false
3539
github_context:
3640
description: 'internal (do not set): the "github" context object in json'
3741
required: true
@@ -65,6 +69,7 @@ runs:
6569
SLSA_PROVENANCE: ${{ inputs.slsa-provenance }}
6670
SBOM: ${{ inputs.sbom }}
6771
SIGN: ${{ inputs.sign }}
72+
PUBLIC_TRANSPARANCY_LOG: ${{ inputs.public_transparancy_log }}
6873
PUSH_ON_GIT_TAG: ${{ inputs.push-on-git-tag }}
6974
GITHUB_CONTEXT: ${{ inputs.github_context }}
7075
RUNNER_CONTEXT: ${{ inputs.runner_context }}

bin/install_cosign.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
COSIGN_RELEASE=v1.14.0
3+
COSIGN_RELEASE=v2.0.0
44
INSTALL_DIR=$HOME/.cosign
55

66
RUNNER_OS=$(uname)
@@ -37,13 +37,13 @@ shaprog() {
3737
esac
3838
}
3939

40-
bootstrap_version='v1.13.1'
41-
bootstrap_linux_amd64_sha='a50651a67b42714d6f1a66eb6773bf214dacae321f04323c0885f6a433051f95'
42-
bootstrap_linux_arm_sha='edc24d49459a73f54e78868a3540e1e54452ad2328c66e1eba8bcd78fcd349fc'
43-
bootstrap_linux_arm64_sha='a7a79a52c7747e2c21554cad4600e6c7130c0429017dd258f9c558d957fa9090'
44-
bootstrap_darwin_amd64_sha='1d164b8b1fcfef1e1870d809edbb9862afd5995cab63687a440b84cca5680ecf'
45-
bootstrap_darwin_arm64_sha='02bef878916be048fd7dcf742105639f53706a59b5b03f4e4eaccc01d05bc7ab'
46-
bootstrap_windows_amd64_sha='78a2774b68b995cc698944f6c235b1c93dcb6d57593a58a565ee7a56d64e4b85'
40+
bootstrap_version='v2.0.0'
41+
bootstrap_linux_amd64_sha='169a53594c437d53ffc401b911b7e70d453f5a2c1f96eb2a736f34f6356c4f2b'
42+
bootstrap_linux_arm_sha='189d56c9946decdaa272e1dccb47ae64009ea39ac0274cfea00507b9acb877c9'
43+
bootstrap_linux_arm64_sha='8132cb2fb99a4c60ba8e03b079e12462c27073028a5d08c07ecda67284e0c88d'
44+
bootstrap_darwin_amd64_sha='d2c8fc0edb42a1e9745da1c43a2928cee044f3b8a1b8df64088a384c7e6f5b5d'
45+
bootstrap_darwin_arm64_sha='9d7821e1c05da4b07513729cb00d1070c9a95332c66d90fa593ed77d8c72ca2a'
46+
bootstrap_windows_amd64_sha='e78e7464dc0eda1d6ec063ac2738f4d1418b19dd19f999aa37e1679d5d3af82e'
4747
cosign_executable_name=cosign
4848

4949
trap "popd >/dev/null" EXIT
@@ -157,7 +157,7 @@ if [[ ${COSIGN_RELEASE} == ${bootstrap_version} ]]; then
157157
log_info "bootstrap version successfully verified and matches requested version so nothing else to do"
158158
exit 0
159159
fi
160-
semver='^v([0-9]+\.){0,2}(\*|[0-9]+)$'
160+
semver='^v([0-9]+\.){0,2}(\*|[0-9]+)(-?r?c?)(\.[0-9]+)$'
161161
if [[ ${COSIGN_RELEASE} =~ $semver ]]; then
162162
log_info "Custom cosign version '${COSIGN_RELEASE}' requested"
163163
else
@@ -197,7 +197,7 @@ if [[ $shaCustom != $shaBootstrap ]]; then
197197
RELEASE_COSIGN_PUB_KEY=https://raw.githubusercontent.com/sigstore/cosign/${COSIGN_RELEASE}/release/release-cosign.pub
198198
fi
199199
log_info "Using bootstrap cosign to verify signature of desired cosign version"
200-
./cosign verify-blob --key $RELEASE_COSIGN_PUB_KEY --signature ${desired_cosign_filename}.sig cosign_${COSIGN_RELEASE}
200+
./cosign verify-blob --insecure-ignore-tlog --key $RELEASE_COSIGN_PUB_KEY --signature ${desired_cosign_filename}.sig cosign_${COSIGN_RELEASE}
201201
rm cosign
202202
mv cosign_${COSIGN_RELEASE} cosign
203203
chmod +x cosign

container_digest.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ then
7373
if [ -n "${KEYLESS}" ]
7474
then
7575
echo 'Keyless signing'
76+
if [ "${PUBLIC_TRANSPARANCY_LOG}" == false ]
77+
then
78+
echo "--------------------------- ERROR --------------------------------"
79+
echo "You want to use keyless signing without a public transparancy log."
80+
echo "We do not support local REKOR and FULCIO servers at this moment."
81+
echo "--------------------------- ERROR --------------------------------"
82+
exit 1
83+
fi
7684
COSIGN_KEY_ARGUMENT=""
7785
COSIGN_PUB_ARGUMENT=""
7886
else
@@ -84,8 +92,8 @@ then
8492
echo "${COSIGN_PRIVATE_KEY}" > "$COSIGN_KEY"
8593
echo "${COSIGN_PUBLIC_KEY}" > "$COSIGN_PUB"
8694

87-
COSIGN_KEY_ARGUMENT="--key $COSIGN_KEY"
88-
COSIGN_PUB_ARGUMENT="--key $COSIGN_PUB"
95+
COSIGN_KEY_ARGUMENT="--insecure-ignore-tlog --key $COSIGN_KEY"
96+
COSIGN_PUB_ARGUMENT="--insecure-ignore-tlog --key $COSIGN_PUB"
8997
fi
9098
echo "Sign image"
9199

@@ -114,7 +122,7 @@ then
114122
then
115123
echo "cosign verify $registry_url_prefix/$imagename@${containerdigest}"
116124
else
117-
echo "cosign verify --key cosign.pub $registry_url_prefix/$imagename@${containerdigest}"
125+
echo "cosign verify --insecure-ignore-tlog --key cosign.pub $registry_url_prefix/$imagename@${containerdigest}"
118126
fi
119127
echo '```'
120128
if [ -n "${KEYLESS}" ]
@@ -178,7 +186,7 @@ then
178186
echo "cosign verify-attestation --type slsaprovenance $registry_url_prefix/$imagename@${containerdigest} | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType==\"https://slsa.dev/provenance/v0.2\" ) | .'"
179187
# TODO: Add tlog
180188
else
181-
echo "cosign verify-attestation --key cosign.pub --type slsaprovenance $registry_url_prefix/$imagename@${containerdigest} | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType==\"https://slsa.dev/provenance/v0.2\" ) | .'"
189+
echo "cosign verify-attestation --insecure-ignore-tlog --key cosign.pub --type slsaprovenance $registry_url_prefix/$imagename@${containerdigest} | jq '.payload |= @base64d | .payload | fromjson | select(.predicateType==\"https://slsa.dev/provenance/v0.2\" ) | .'"
182190
fi
183191
echo '```'
184192
if [ -n "${KEYLESS}" ]
@@ -234,7 +242,7 @@ then
234242
echo "cosign verify-attestation --type spdx $registry_url_prefix/$imagename@${containerdigest} | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType==\"https://spdx.dev/Document\" ) | .predicate.Data | fromjson | .'"
235243
# TODO: Add tlog
236244
else
237-
echo "cosign verify-attestation --key cosign.pub --type spdx $registry_url_prefix/$imagename@${containerdigest} | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType==\"https://spdx.dev/Document\" ) | .predicate.Data | fromjson | .'"
245+
echo "cosign verify-attestation --insecure-ignore-tlog --key cosign.pub --type spdx $registry_url_prefix/$imagename@${containerdigest} | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType==\"https://spdx.dev/Document\" ) | .predicate.Data | fromjson | .'"
238246
fi
239247
echo '```'
240248
if [ -n "${KEYLESS}" ]

0 commit comments

Comments
 (0)