@@ -734,8 +734,18 @@ jobs:
734734 if ! jq -e '
735735 type == "object" and
736736 (.matches | type == "array") and
737- (.descriptor.db.built | type == "string") and
738- (.descriptor.db.checksum | type == "string")
737+ (
738+ (.descriptor.db.built // .descriptor.db.status.built)
739+ | type == "string"
740+ ) and
741+ (
742+ (.descriptor.db.checksum | type == "string") or
743+ (
744+ .descriptor.db.status.from
745+ | type == "string" and
746+ test("checksum=sha256%3A[0-9a-fA-F]{64}")
747+ )
748+ )
739749 ' "${report}" >/dev/null; then
740750 echo "Grype did not emit a complete scan report (exit ${status})" >&2
741751 exit 1
@@ -744,6 +754,22 @@ jobs:
744754 echo "::warning::Grype exited ${status}; enforcing its complete report through the reviewed advisory policy"
745755 fi
746756 }
757+ read_db_metadata() {
758+ local report="$1"
759+ jq -er '
760+ [
761+ (.descriptor.db.built // .descriptor.db.status.built),
762+ (
763+ .descriptor.db.checksum //
764+ (
765+ .descriptor.db.status.from
766+ | capture("checksum=sha256%3A(?<digest>[0-9a-fA-F]{64})").digest
767+ | ascii_downcase
768+ )
769+ )
770+ ] | @tsv
771+ ' "${report}"
772+ }
747773 for name in registry-notary registry-relay; do
748774 digest_ref="$(cat "inputs/build-a/dist/images/${name}.digest")"
749775 expected_label_args=()
@@ -779,8 +805,9 @@ jobs:
779805 echo "Exported rootfs ${name} contains a forbidden special file" >&2
780806 exit 1
781807 fi
782- db_built="$(jq -er '.descriptor.db.built' "dist/candidate/dist/grype/${name}.grype.json")"
783- db_checksum="$(jq -er '.descriptor.db.checksum' "dist/candidate/dist/grype/${name}.grype.json")"
808+ IFS=$'\t' read -r db_built db_checksum < <(
809+ read_db_metadata "dist/candidate/dist/grype/${name}.grype.json"
810+ )
784811 db_built_epoch="$(date -u -d "${db_built}" +%s)"
785812 now_epoch="$(date -u +%s)"
786813 if (( db_built_epoch > now_epoch || now_epoch - db_built_epoch > 259200 )); then
@@ -810,8 +837,9 @@ jobs:
810837 echo "Exported rootfs postgresql contains a forbidden special file" >&2
811838 exit 1
812839 fi
813- db_built="$(jq -er '.descriptor.db.built' dist/candidate/dist/grype/postgresql.grype.json)"
814- db_checksum="$(jq -er '.descriptor.db.checksum' dist/candidate/dist/grype/postgresql.grype.json)"
840+ IFS=$'\t' read -r db_built db_checksum < <(
841+ read_db_metadata dist/candidate/dist/grype/postgresql.grype.json
842+ )
815843 db_built_epoch="$(date -u -d "${db_built}" +%s)"
816844 now_epoch="$(date -u +%s)"
817845 if (( db_built_epoch > now_epoch || now_epoch - db_built_epoch > 259200 )); then
0 commit comments