@@ -243,6 +243,8 @@ func ImageIndex2ImageSummary(ctx context.Context, repo, tag string, indexDigest
243243
244244 annotations := GetAnnotations (indexContent .Annotations , map [string ]string {})
245245
246+ signaturesInfo := GetSignaturesInfo (isSigned , repoMeta , indexDigest )
247+
246248 indexSummary := gql_generated.ImageSummary {
247249 RepoName : & repo ,
248250 Tag : & tag ,
@@ -251,6 +253,7 @@ func ImageIndex2ImageSummary(ctx context.Context, repo, tag string, indexDigest
251253 Manifests : manifestSummaries ,
252254 LastUpdated : & indexLastUpdated ,
253255 IsSigned : & isSigned ,
256+ SignatureInfo : signaturesInfo ,
254257 Size : & indexSize ,
255258 DownloadCount : & totalDownloadCount ,
256259 Description : & annotations .Description ,
@@ -354,6 +357,8 @@ func ImageManifest2ImageSummary(ctx context.Context, repo, tag string, digest go
354357 }
355358 }
356359
360+ signaturesInfo := GetSignaturesInfo (isSigned , repoMeta , digest )
361+
357362 imageSummary := gql_generated.ImageSummary {
358363 RepoName : & repoName ,
359364 Tag : & tag ,
@@ -366,6 +371,7 @@ func ImageManifest2ImageSummary(ctx context.Context, repo, tag string, digest go
366371 LastUpdated : & imageLastUpdated ,
367372 Size : & imageSize ,
368373 IsSigned : & isSigned ,
374+ SignatureInfo : signaturesInfo ,
369375 Platform : & platform ,
370376 DownloadCount : & downloadCount ,
371377 Layers : getLayersSummaries (manifestContent ),
@@ -380,6 +386,7 @@ func ImageManifest2ImageSummary(ctx context.Context, repo, tag string, digest go
380386 },
381387 LastUpdated : & imageLastUpdated ,
382388 IsSigned : & isSigned ,
389+ SignatureInfo : signaturesInfo ,
383390 Size : & imageSize ,
384391 DownloadCount : & downloadCount ,
385392 Description : & annotations .Description ,
@@ -511,6 +518,8 @@ func ImageManifest2ManifestSummary(ctx context.Context, repo, tag string, descri
511518 }
512519 }
513520
521+ signaturesInfo := GetSignaturesInfo (isSigned , repoMeta , digest )
522+
514523 manifestSummary := gql_generated.ManifestSummary {
515524 Digest : & manifestDigestStr ,
516525 ConfigDigest : & configDigest ,
@@ -521,6 +530,7 @@ func ImageManifest2ManifestSummary(ctx context.Context, repo, tag string, descri
521530 Layers : getLayersSummaries (manifestContent ),
522531 History : historyEntries ,
523532 IsSigned : & isSigned ,
533+ SignatureInfo : signaturesInfo ,
524534 Vulnerabilities : & gql_generated.ImageVulnerabilitySummary {
525535 MaxSeverity : & imageCveSummary .MaxSeverity ,
526536 Count : & imageCveSummary .Count ,
@@ -744,3 +754,44 @@ func GetPreloadString(prefix, name string) string {
744754
745755 return name
746756}
757+
758+ func GetSignaturesInfo (isSigned bool , repoMeta repodb.RepoMetadata , indexDigest godigest.Digest ,
759+ ) []* gql_generated.SignatureSummary {
760+ signaturesInfo := []* gql_generated.SignatureSummary {}
761+
762+ if ! isSigned {
763+ return signaturesInfo
764+ }
765+
766+ for sigType , signatures := range repoMeta .Signatures [indexDigest .String ()] {
767+ for _ , sig := range signatures {
768+ for _ , layer := range sig .LayersInfo {
769+ var (
770+ isTrusted bool
771+ author string
772+ tool string
773+ )
774+
775+ if layer .Signer != "" {
776+ author = layer .Signer
777+
778+ if ! layer .Date .IsZero () && time .Now ().After (layer .Date ) {
779+ isTrusted = false
780+ } else {
781+ isTrusted = true
782+ }
783+ } else {
784+ isTrusted = false
785+ author = ""
786+ }
787+
788+ tool = sigType
789+
790+ signaturesInfo = append (signaturesInfo ,
791+ & gql_generated.SignatureSummary {Tool : & tool , IsTrusted : & isTrusted , Author : & author })
792+ }
793+ }
794+ }
795+
796+ return signaturesInfo
797+ }
0 commit comments