@@ -237,41 +237,16 @@ verify_cosign_attestation() {
237237 return 1
238238}
239239
240- # Verify attestations for a single image digest
240+ # Verify attestations for a single image digest (platform-specific)
241241verify_image_digest () {
242242 local image_name=" $1 "
243243 local digest=" $2 "
244244 local arch=" $3 "
245245 local os=" $4 "
246- local image_ref=" ${REGISTRY} /${ORG} /${image_name} @${digest} "
247246
248247 echo -e " ${BLUE} ${os} /${arch} - ${digest}${NC} "
249248
250- local cosign_ok=false
251-
252- # Verify Cosign SBOM attestation (OCI 1.1 referrers format)
253- # This is the primary attestation we're checking
254- if verify_cosign_attestation " $image_ref " " $digest " ; then
255- echo -e " ${GREEN} ✓ Cosign SBOM attestation (OCI 1.1 referrers)${NC} "
256- cosign_ok=true
257- else
258- echo -e " ${RED} ✗ Cosign SBOM attestation not found${NC} "
259- fi
260-
261- # Optionally verify GitHub build provenance attestation
262- # Note: This requires 'gh' CLI authentication and may not be present for all images
263- if command -v gh & > /dev/null && gh auth status & > /dev/null; then
264- if verify_github_attestation " $image_ref " ; then
265- echo -e " ${GREEN} ✓ GitHub build provenance attestation${NC} "
266- fi
267- fi
268-
269- # Consider image verified if Cosign SBOM attestation exists
270- if $cosign_ok ; then
271- return 0
272- else
273- return 1
274- fi
249+ return 0
275250}
276251
277252# Verify attestations for a single image
@@ -290,6 +265,18 @@ verify_image() {
290265 return
291266 fi
292267
268+ # Get the manifest list digest (for multi-platform images) or image digest (for single-platform)
269+ local manifest_digest
270+ manifest_digest=$( crane digest " $image_ref " 2> /dev/null || echo " " )
271+
272+ if [ -z " $manifest_digest " ]; then
273+ echo -e " ${RED} ✗ Failed to get manifest digest${NC} "
274+ FAILED_IMAGES=$(( FAILED_IMAGES + 1 ))
275+ return
276+ fi
277+
278+ echo -e " ${BLUE} Manifest digest: ${manifest_digest}${NC} "
279+
293280 # Get platform information
294281 local platform_info
295282 platform_info=$( get_platform_info " $image_ref " )
@@ -300,19 +287,38 @@ verify_image() {
300287 return
301288 fi
302289
303- # Verify each platform
304- local all_passed=true
290+ # Display platform information
305291 while IFS=' |' read -r digest arch os; do
306- if ! verify_image_digest " $image_name " " $digest " " $arch " " $os " ; then
307- all_passed=false
308- fi
292+ verify_image_digest " $image_name " " $digest " " $arch " " $os "
309293 done <<< " $platform_info"
310294
311- if $all_passed ; then
295+ # Verify attestations on the manifest list digest (correct for multi-platform images)
296+ local manifest_ref=" ${REGISTRY} /${ORG} /${image_name} @${manifest_digest} "
297+ local cosign_ok=false
298+
299+ echo -e " ${BLUE} Checking attestations on manifest list...${NC} "
300+
301+ # Verify Cosign SBOM attestation (OCI 1.1 referrers format)
302+ if verify_cosign_attestation " $manifest_ref " " $manifest_digest " ; then
303+ echo -e " ${GREEN} ✓ Cosign SBOM attestation (OCI 1.1 referrers)${NC} "
304+ cosign_ok=true
305+ else
306+ echo -e " ${RED} ✗ Cosign SBOM attestation not found${NC} "
307+ fi
308+
309+ # Optionally verify GitHub build provenance attestation
310+ if command -v gh & > /dev/null && gh auth status & > /dev/null; then
311+ if verify_github_attestation " $manifest_ref " ; then
312+ echo -e " ${GREEN} ✓ GitHub build provenance attestation${NC} "
313+ fi
314+ fi
315+
316+ # Consider image verified if Cosign SBOM attestation exists
317+ if $cosign_ok ; then
312318 echo -e " ${GREEN} ✓ All attestations verified${NC} "
313319 PASSED_IMAGES=$(( PASSED_IMAGES + 1 ))
314320 else
315- echo -e " ${RED} ✗ Some attestations missing${NC} "
321+ echo -e " ${RED} ✗ Attestations missing${NC} "
316322 FAILED_IMAGES=$(( FAILED_IMAGES + 1 ))
317323 fi
318324}
0 commit comments