Skip to content

Commit 98d49ef

Browse files
authored
fix release: pass keyless cert identity/issuer in cosign verify (#2)
1 parent 8174120 commit 98d49ef

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

scripts/verify_release_artifacts.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,31 @@ fi
1515

1616
if [[ -f "${DIST_DIR}/checksums.txt.sig" && -f "${DIST_DIR}/checksums.txt.pem" ]]; then
1717
if command -v cosign >/dev/null 2>&1; then
18-
cosign verify-blob --certificate "${DIST_DIR}/checksums.txt.pem" --signature "${DIST_DIR}/checksums.txt.sig" "${DIST_DIR}/checksums.txt"
18+
verify_args=(
19+
verify-blob
20+
--certificate "${DIST_DIR}/checksums.txt.pem"
21+
--signature "${DIST_DIR}/checksums.txt.sig"
22+
)
23+
24+
cert_identity="${COSIGN_CERT_IDENTITY:-}"
25+
cert_issuer="${COSIGN_CERT_ISSUER:-}"
26+
27+
if [[ -z "${cert_identity}" && -n "${GITHUB_WORKFLOW_REF:-}" ]]; then
28+
cert_identity="https://github.com/${GITHUB_WORKFLOW_REF}"
29+
fi
30+
if [[ -z "${cert_issuer}" && -n "${GITHUB_ACTIONS:-}" ]]; then
31+
cert_issuer="https://token.actions.githubusercontent.com"
32+
fi
33+
34+
if [[ -n "${cert_identity}" ]]; then
35+
verify_args+=(--certificate-identity "${cert_identity}")
36+
fi
37+
if [[ -n "${cert_issuer}" ]]; then
38+
verify_args+=(--certificate-oidc-issuer "${cert_issuer}")
39+
fi
40+
41+
verify_args+=("${DIST_DIR}/checksums.txt")
42+
cosign "${verify_args[@]}"
1943
else
2044
echo "cosign not installed; skipping signature verification"
2145
fi

0 commit comments

Comments
 (0)