Skip to content

Commit b478944

Browse files
CLOUDP-354456 - Conform kubectl-mongodb signing to new 3.0.2 version of cosign (#555)
# Summary Due to the [bug](sigstore/cosign#3371) in `cosign` we wanted to upgrade it to newer `3.0.2` version. Because of major version change `cosign sign-blob` and `cosign verify-blob` commands now [require](https://github.com/sigstore/cosign/releases/tag/v3.0.1) specifying `--bundle` that will contain both signature and some other information. In this PR we start using `--bundle` flag when signing and verifying `kubectl-mongodb` binaries. The contents of the new bundle: ```json { "mediaType": "application/vnd.dev.sigstore.bundle.v0.3+json", "verificationMaterial": { "publicKey": { "hint": "AU1VLmJtWc+qqAKpD3BfZ81beo7rZ2hAI54Z+0Dz8Vw=" } }, "messageSignature": { "messageDigest": { "algorithm": "SHA2_256", "digest": "XXQAwZCjdATTeHFH29uYN1MSAm1LP27/AiDkl9YKfqs=" }, "signature": "TUs36qhf5p2fuVPuogl3bAslg0bycy+I8Ul1JwqHvAffpjKwXDNdXk9/OdjoiZrwhKqVrutQOpLac4JK+NQpEab7EfOZdRfX1SqurM4kE0izPg/SWJ2Me1LLXT6/nCnG+n5buKIJzw6EGOjcAlzC3P6ok08mJp6s57DTeDVv3uBl6RCv3GqR5uLzXNSCHgo/pZBSIUcNzAGqM6FZsgUhH9uiCDH9nzWwyuqfOF8DDJ+W1BT0gqP0Zs+qVtS2+MmYH9mx9a2MQ4ph8PgrTiqgZOxQX6QTmZ8/YTAPj1gmRLrYj+B9QW0XDAEiBuhJC6EyBWU5QpZaT0X5CvtPIhsF3qvCZrIkccnuUKdebHkrKPycGp5vHnkXfFra4SMdQH1yXduGMNrCA+grJ7DQ7uwoRSHIHnkQQlThZC0SjtFb0Qri+D0ExXIPiRcC/86KB5na/9tdaiwrKKEQF0KpV61vUE8iruQxttc1GllRSWPWFKS2do8s/xGc3HzKkriauGkVSI25S72zlvbQxtuosTmqIDHHH6z7jeY0cMUPr+wt1Vg+DU8InpL8SYfgN20swLn9lvBIucu6C/Cax/lC9FkWL8C6rTN8wcD1jsHrSeuais1sT/9grbyUo2pgU701CbpD3NhyFpd9MPO0Lkbzk+/ZYVFgCfQdVLL5ai9dNevX0R4=" } } ``` Previous signature only file: >bsQWZtrco0D3LpUWk0kYcPq1J3hnBl9xez2//gse5M4/4VCQW/5HM7nvBktM9WO1fJDrkKzFqbYk994nj5OHOchSj8vudcyy9TMzTROc0jZyr5wnw3buhTYvCVHvfO50x/0y1ST6fyidxG4IBRz3yidqzxckHn0MecHKvDrrycB2Qzh0oipb6sCLPH7uBhpi6Kjla5FQfjlQ/rRdUW+gk9rnYSBzAJ157tgmsl1ReWlUTwD0lHxeozQ5BTD1AZ7I/Z48wU5YmOjsWO+xyjjq3lW2B+tUB8ddN2u2Sq1uiuH2djFFsOOQutCXclqVgXC7you5jjJ18Tm30oTyRrkLk4xtqIWrqMLa0p15XZpCMErmMv7j0tJr8DsFsXrYq7gep+eBu5i6jEP6y6re1cFNDpOWrFWmLM6PrHBv6I5K/Gfw2sSmqPG10wkQRLMvhhL4lHa7+oevA+x76VpgrYXH8KtVfaGAyw9v+houiVtsYPJJ9NzWAJicIkU9gyVvShsSidQElU7ije7MFhCAWyACJ30sDDOuKEAkKEsEnARMflA5k40ZOT0oIMG03+50UhRC3ERB6Yjff+X4ows59qc8G1i1ArUiL7eIpH3oKvDJsJ9Q6MXE9GdPbLNI/BMupkBucEq0o0dlSW0VXOzJRiAOu4JBg/kv1E1/p4f4z4y2J/I= Additionally I had to disable sending tlog based on [Release Tools team requirement](https://docs.devprod.prod.corp.mongodb.com/release-tools-container-images/garasign/garasign_signing#:~:text=Please%20note%20that%20all%20teams%20should%20not%20upload%20any%20material%20to%20Sigstore%27s%20public%20transparency%20log%20by%20setting%20the%20%2D%2Dtlog%2Dupload%20flag%20to%20false.) >Please note that all teams should not upload any material to Sigstore's public transparency log by setting the --tlog-upload flag to false ## Proof of Work Passing signing and verifying steps of [release_kubectl_mongodb_plugin](https://spruce.mongodb.com/task/mongodb_kubernetes_release_kubectl_mongodb_plugin_release_kubectl_mongodb_plugin_patch_061775975fc7f55815982e3119c1a9fed60a4297_68ff916a0254e00007fdb89b_25_10_27_15_36_12/logs?execution=0). ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] https://jira.mongodb.org/browse/DOCSP-55017 - [x] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details --------- Co-authored-by: Julien-Ben <[email protected]>
1 parent a29a2a0 commit b478944

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
kind: other
3+
date: 2025-10-27
4+
---
5+
6+
* **kubectl-mongodb plugin**: `cosign`, the signing tool that is used to sign `kubectl-mongodb` plugin binaries, has been updated to version `3.0.2`. With this change, released binaries will be bundled with `.bundle` files containing both signature and certificate information. For more information on how to verify signatures using new `cosign` version please refer to -> https://github.com/sigstore/cosign/blob/v3.0.2/doc/cosign_verify-blob.md

scripts/release/kubectl_mongodb/sign.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -euo pipefail
88
# Sign a binary using garasign credentials
99

1010
ARTIFACT=$1
11-
SIGNATURE="${ARTIFACT}.sig"
11+
SIGNATURE_BUNDLE="${ARTIFACT}.bundle"
1212

1313
TMPDIR=${TMPDIR:-/tmp}
1414
SIGNING_ENVFILE="${TMPDIR}/signing-envfile"
@@ -21,7 +21,7 @@ SIGNING_IMAGE_URI=${SIGNING_IMAGE_URI}
2121
ARTIFACTORY_PASSWORD=${ARTIFACTORY_PASSWORD}
2222
ARTIFACTORY_USERNAME=${ARTIFACTORY_USERNAME}
2323

24-
echo "Signing artifact ${ARTIFACT} and saving signature to ${SIGNATURE}"
24+
echo "Signing artifact ${ARTIFACT} and saving signature bundle to ${SIGNATURE_BUNDLE}"
2525

2626
{
2727
echo "GRS_CONFIG_USER1_USERNAME=${GRS_USERNAME}";
@@ -40,4 +40,4 @@ docker run \
4040
-v "$(pwd)":"$(pwd)" \
4141
-w "$(pwd)" \
4242
"${SIGNING_IMAGE_URI}" \
43-
cosign sign-blob --key "${PKCS11_URI}" --output-signature "${SIGNATURE}" "${ARTIFACT}" --yes
43+
cosign sign-blob --key "${PKCS11_URI}" --tlog-upload=false --use-signing-config=false --bundle "${SIGNATURE_BUNDLE}" "${ARTIFACT}" --yes

scripts/release/kubectl_mongodb/verify.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
set -euo pipefail
44

5-
# Verify the signature of a binary with the operator's public key
5+
# Verify the signature bundle of a binary with the operator's public key
66

77
ARTIFACT=$1
8-
SIGNATURE="${ARTIFACT}.sig"
8+
SIGNATURE_BUNDLE="${ARTIFACT}.bundle"
99

1010
HOSTED_SIGN_PUBKEY="https://cosign.mongodb.com/mongodb-enterprise-kubernetes-operator.pem" # to complete
1111
TMPDIR=${TMPDIR:-/tmp}
@@ -14,19 +14,19 @@ KEY_FILE="${TMPDIR}/host-public.key"
1414
SIGNING_IMAGE_URI="${SIGNING_IMAGE_URI}"
1515

1616
curl -o "${KEY_FILE}" "${HOSTED_SIGN_PUBKEY}"
17-
echo "Verifying signature ${SIGNATURE} of artifact ${ARTIFACT}"
17+
echo "Verifying signature bundle ${SIGNATURE_BUNDLE} of artifact ${ARTIFACT}"
1818
echo "Keyfile is ${KEY_FILE}"
1919

2020
# When working locally, the following command can be used instead of Docker
21-
# cosign verify-blob --key ${KEY_FILE} --signature ${SIGNATURE} ${ARTIFACT}
21+
# cosign verify-blob --key ${KEY_FILE} --insecure-ignore-tlog --bundle ${SIGNATURE_BUNDLE} ${ARTIFACT}
2222

2323
docker run \
2424
--rm \
2525
-v "$(pwd)":"$(pwd)" \
2626
-v "${KEY_FILE}":"${KEY_FILE}" \
2727
-w "$(pwd)" \
2828
"${SIGNING_IMAGE_URI}" \
29-
cosign verify-blob --key "${KEY_FILE}" --signature "${SIGNATURE}" "${ARTIFACT}"
29+
cosign verify-blob --key "${KEY_FILE}" --insecure-ignore-tlog --bundle "${SIGNATURE_BUNDLE}" "${ARTIFACT}"
3030

31-
# Without below line, Evergreen fails at archiving with "open dist/kubectl-[...]/kubectl-mongodb.sig: permission denied
32-
sudo chmod 666 "${SIGNATURE}"
31+
# Without below line, Evergreen fails at archiving with "open dist/kubectl-[...]/kubectl-mongodb.bundle: permission denied
32+
sudo chmod 666 "${SIGNATURE_BUNDLE}"

0 commit comments

Comments
 (0)