Skip to content

Modern Docker Management, Designed for Everyone

feat: show attestations panel for images when supported (#3036)

Kyle Mendellf769386de8ab
diff --git a/backend/api/handlers/images.go b/backend/api/handlers/images.go
index 043bdf957..ee5ce2918 100644
--- a/backend/api/handlers/images.go
+++ b/backend/api/handlers/images.go
@@ -6,8 +6,10 @@ import (
"fmt"
"mime/multipart"
"net/http"
+ "net/url"
"strings"
+ "github.com/containerd/platforms"
"github.com/danielgtaylor/huma/v2"
humamw "github.com/getarcaneapp/arcane/backend/v2/api/middleware"
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
@@ -67,6 +69,18 @@ type GetImageOutput struct {
Body base.ApiResponse[image.DetailSummary]
}
+type GetImageAttestationsInput struct {
+ EnvironmentID string `path:"id" doc:"Environment ID"`
+ ImageName string `path:"name" doc:"Image ID or image reference"`
+ Platform string `query:"platform" doc:"OCI platform selector, for example linux/amd64"`
+ PredicateType string `query:"predicateType" doc:"Exact in-toto predicate type URI to include"`
+ WithStatement bool `query:"statement" default:"false" doc:"Include verbatim statement JSON bodies"`
+}
+
+type GetImageAttestationsOutput struct {
+ Body base.ApiResponse[image.AttestationList]
+}
+
type RemoveImageInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ImageID string `path:"imageId" doc:"Image ID"`
@@ -192,6 +206,19 @@ func RegisterImages(api huma.API, dockerService *services.DockerClientService, i
},
}, authz.PermImagesList, h.GetImageUsageCounts)
+ humamw.RegisterWithPermission(api, huma.Operation{
+ OperationID: "get-image-attestations",
+ Method: http.MethodGet,
+ Path: "/environments/{id}/images/{name}/attestations",
+ Summary: "Get image attestations",
+ Description: "Get in-toto attestation statements attached to a Docker image",
+ Tags: []string{"Images"},
+ Security: []map[string][]string{
+ {"BearerAuth": {}},
+ {"ApiKeyAuth": {}},
+ },
+ }, authz.PermImagesRead, h.GetImageAttestations)
+
humamw.RegisterWithPermission(api, huma.Operation{
OperationID: "get-image",
Method: http.MethodGet,
@@ -369,6 +396,44 @@ func (h *ImageHandler) GetImage(ctx context.Context, input *GetImageInput) (*Get
}, nil
}
+// GetImageAttestations returns in-toto attestation statements attached to an image.
+func (h *ImageHandler) GetImageAttestations(ctx context.Context, input *GetImageAttestationsInput) (*GetImageAttestationsOutput, error) {
+ if h.imageService == nil {
+ return nil, huma.Error500InternalServerError("service not available")
+ }
+
+ imageName, err := url.PathUnescape(input.ImageName)
+ if err != nil {
+ return nil, huma.Error400BadRequest(fmt.Sprintf("invalid image name %q", input.ImageName))
+ }
+ imageName = strings.TrimSpace(imageName)
+ if imageName == "" {
+ return nil, huma.Error400BadRequest("image name is required")
+ }
+
+ if input.Platform != "" {
+ if _, err := platforms.Parse(input.Platform); err != nil {
+ return nil, huma.Error400BadRequest(fmt.Sprintf("invalid platform %q", input.Platform))
+ }
+ }
+
+ out, err := h.imageService.GetImageAttestations(ctx, imageName, services.ImageAttestationQuery{
+ Platform: strings.TrimSpace(input.Platform),
+ PredicateType: strings.TrimSpace(input.PredicateType),
+ IncludeStatement: input.WithStatement,
+ })
+ if err != nil {
+ return nil, huma.Error500InternalServerError(fmt.Sprintf("failed to get image attestations: %v", err))
+ }
+
+ return &GetImageAttestationsOutput{
+ Body: base.ApiResponse[image.AttestationList]{
+ Success: true,
+ Data: *out,
+ },
+ }, nil
+}
+
// RemoveImage removes a Docker image.
func (h *ImageHandler) RemoveImage(ctx context.Context, input *RemoveImageInput) (*RemoveImageOutput, error) {
if h.imageService == nil {
diff --git a/backend/go.mod b/backend/go.mod
index 6fefa7ba6..52f42c7ea 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -16,6 +16,7 @@ require (
github.com/cenkalti/backoff/v5 v5.0.3
github.com/compose-spec/compose-go/v2 v2.12.1
github.com/containerd/errdefs v1.0.0
+ github.com/containerd/platforms v1.0.0-rc.4
github.com/coreos/go-oidc/v3 v3.19.0
github.com/danielgtaylor/huma/v2 v2.38.0
github.com/depot/depot-go v0.5.2
@@ -31,11 +32,13 @@ require (
github.com/goccy/go-yaml v1.19.2
github.com/gofrs/flock v0.13.0
github.com/golang-jwt/jwt/v5 v5.3.1
+ github.com/google/go-containerregistry v0.21.6
github.com/google/uuid v1.6.0
github.com/google/wire v0.7.0
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
github.com/jinzhu/copier v0.4.0
github.com/joho/godotenv v1.5.1
+ github.com/klauspost/compress v1.18.6
github.com/labstack/echo/v4 v4.15.4
github.com/lmittmann/tint v1.1.3
github.com/moby/buildkit v0.31.0
@@ -99,7 +102,6 @@ require (
github.com/containerd/continuity v0.5.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
- github.com/containerd/platforms v1.0.0-rc.4 // indirect
github.com/containerd/ttrpc v1.2.8 // indirect
github.com/containerd/typeurl/v2 v2.3.0 // indirect
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
@@ -146,7 +148,6 @@ require (
github.com/jinzhu/now v1.1.5 // indirect
github.com/jonboulle/clockwork v0.5.0 // indirect
github.com/kevinburke/ssh_config v1.6.0 // indirect
- github.com/klauspost/compress v1.18.6 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/labstack/gommon v0.5.0 // indirect
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
diff --git a/backend/internal/services/image_attestations_service.go b/backend/internal/services/image_attestations_service.go
new file mode 100644
index 000000000..ba4732c79
--- /dev/null
+++ b/backend/internal/services/image_attestations_service.go
@@ -0,0 +1,607 @@
+package services
+
+import (
+ "bytes"
+ "compress/gzip"
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "log/slog"
+ "net/http"
+ "strings"
+
+ "github.com/containerd/platforms"
+ utilsregistry "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/registryauth"
+ imagetypes "github.com/getarcaneapp/arcane/types/v2/image"
+ "github.com/google/go-containerregistry/pkg/authn"
+ "github.com/google/go-containerregistry/pkg/name"
+ v1 "github.com/google/go-containerregistry/pkg/v1"
+ "github.com/google/go-containerregistry/pkg/v1/remote"
+ "github.com/google/go-containerregistry/pkg/v1/remote/transport"
+ "github.com/google/go-containerregistry/pkg/v1/types"
+ "github.com/klauspost/compress/zstd"
+ attestationTypes "github.com/moby/buildkit/util/attestation"
+ ocispec "github.com/opencontainers/image-spec/specs-go/v1"
+)
+
+const (
+ dockerAttestationManifestArtifactTypeInternal = "application/vnd.docker.attestation.manifest.v1+json"
+ inTotoLayerMediaTypeInternal = "application/vnd.in-toto+json"
+ inTotoPredicateTypeAnnotationInternal = "in-toto.io/predicate-type"
+)
+
+type ImageAttestationQuery struct {
+ Platform string
+ PredicateType string
+ IncludeStatement bool
+}
+
+type imageAttestationReferenceInternal struct {
+ ImageRef string
+ SubjectDigest string
+ Empty bool
+}
+
+type imageAttestationSubjectInternal struct {
+ Descriptor v1.Descriptor
+ Digest string
+ Platform string
+}
+
+type attestationStatementEnvelopeInternal struct {
+ Type string `json:"_type"`
+ PredicateType string `json:"predicateType"`
+ Subject []imagetypes.AttestationSubject `json:"subject"`
+}
+
+// GetImageAttestations returns in-toto attestations attached to a local image or registry reference.
+func (s *ImageService) GetImageAttestations(ctx context.Context, imageName string, query ImageAttestationQuery) (*imagetypes.AttestationList, error) {
+ resolution, err := s.resolveImageAttestationReferenceInternal(ctx, imageName)
+ if err != nil {
+ return nil, err
+ }
+
+ out := &imagetypes.AttestationList{
+ ImageRef: resolution.ImageRef,
+ SubjectDigest: resolution.SubjectDigest,
+ Platform: strings.TrimSpace(query.Platform),
+ Attestations: []imagetypes.Attestation{},
+ }
+ if resolution.Empty {
+ return out, nil
+ }
+
+ platform, hasPlatform, err := parseAttestationPlatformInternal(query.Platform)
+ if err != nil {
+ return nil, err
+ }
+
+ ref, err := name.ParseReference(resolution.ImageRef, name.WeakValidation)
+ if err != nil {
+ return nil, fmt.Errorf("parse image reference %q: %w", resolution.ImageRef, err)
+ }
+
+ remoteOptions := s.remoteOptionsForImageRefInternal(ctx, resolution.ImageRef)
+ remoteDescriptor, err := remote.Get(ref, remoteOptions...)
+ if err != nil {
+ return nil, fmt.Errorf("get image manifest %q: %w", resolution.ImageRef, err)
+ }
+
+ if out.SubjectDigest == "" {
+ out.SubjectDigest = remoteDescriptor.Digest.String()
+ }
+
+ index, subjects, err := imageAttestationSubjectsInternal(remoteDescriptor, platform, hasPlatform)
+ if err != nil {
+ return nil, err
+ }
+ if hasPlatform && len(subjects) > 0 {
+ out.SubjectDigest = subjects[0].Digest
+ out.Platform = subjects[0].Platform
+ }
+
+ attestations := make([]imagetypes.Attestation, 0)
+ for _, subject := range subjects {
+ referrerAttestations, err := s.readReferrerAttestationsInternal(ctx, ref.Context(), subject, remoteOptions, query)
+ if err != nil {
+ return nil, err
+ }
+ attestations = append(attestations, referrerAttestations...)
+ }
+
+ if index != nil {
+ inlineAttestations, err := readInlineAttestationsInternal(ctx, index, subjects, query)
+ if err != nil {
+ return nil, err
+ }
+ attestations = append(attestations, inlineAttestations...)
+ }
+
+ out.Attestations = dedupeAttestationsInternal(attestations)
+ return out, nil
+}
+
+func (s *ImageService) resolveImageAttestationReferenceInternal(ctx context.Context, imageName string) (imageAttestationReferenceInternal, error) {
+ imageName = strings.TrimSpace(imageName)
+ if imageName == "" {
+ return imageAttestationReferenceInternal{}, errors.New("image name is required")
+ }
+
+ if s != nil && s.dockerService != nil {
+ dockerClient, err := s.dockerService.GetClient(ctx)
+ if err == nil {
+ inspect, inspectErr := dockerClient.ImageInspect(ctx, imageName)
+ if inspectErr == nil {
+ imageRef := firstUsableImageReferenceInternal(inspect.RepoDigests, inspect.RepoTags)
+ if imageRef == "" {
+ return imageAttestationReferenceInternal{ImageRef: imageName, Empty: true}, nil
+ }
+ return imageAttestationReferenceInternal{
+ ImageRef: imageRef,
+ SubjectDigest: digestFromReferenceInternal(imageRef),
+ }, nil
+ }
+ }
+ }
+
+ if isLikelyLocalImageIDInternal(imageName) {
+ return imageAttestationReferenceInternal{}, fmt.Errorf("image %q does not have a registry reference", imageName)
+ }
+ if _, err := name.ParseReference(imageName, name.WeakValidation); err != nil {
+ return imageAttestationReferenceInternal{}, fmt.Errorf("image %q does not have a registry reference: %w", imageName, err)
+ }
+ return imageAttestationReferenceInternal{
+ ImageRef: imageName,
+ SubjectDigest: digestFromReferenceInternal(imageName),
+ }, nil
+}
+
+func firstUsableImageReferenceInternal(repoDigests, repoTags []string) string {
+ for _, repoDigest := range repoDigests {
+ if isUsableImageReferenceInternal(repoDigest) && strings.Contains(repoDigest, "@sha256:") {
+ return strings.TrimSpace(repoDigest)
+ }
+ }
+ for _, repoTag := range repoTags {
+ if isUsableImageReferenceInternal(repoTag) {
+ return strings.TrimSpace(repoTag)
+ }
+ }
+ return ""
+}
+
+func isUsableImageReferenceInternal(value string) bool {
+ value = strings.TrimSpace(value)
+ return value != "" && !strings.Contains(value, "<none>")
+}
+
+func isLikelyLocalImageIDInternal(value string) bool {
+ value = strings.TrimSpace(value)
+ if strings.HasPrefix(value, "sha256:") {
+ return true
+ }
+ if len(value) != 64 {
+ return false
+ }
+ for _, r := range value {
+ if (r < '0' || r > '9') && (r < 'a' || r > 'f') && (r < 'A' || r > 'F') {
+ return false
+ }
+ }
+ return true
+}
+
+func digestFromReferenceInternal(imageRef string) string {
+ if _, digest, found := strings.Cut(strings.TrimSpace(imageRef), "@"); found {
+ return digest
+ }
+ return ""
+}
+
+func parseAttestationPlatformInternal(value string) (ocispec.Platform, bool, error) {
+ value = strings.TrimSpace(value)
+ if value == "" {
+ return ocispec.Platform{}, false, nil
+ }
+
+ platform, err := platforms.Parse(value)
+ if err != nil {
+ return ocispec.Platform{}, false, fmt.Errorf("invalid platform %q: %w", value, err)
+ }
+ return platform, true, nil
+}
+
+func (s *ImageService) remoteOptionsForImageRefInternal(ctx context.Context, imageRef string) []remote.Option {
+ options := make([]remote.Option, 0, 2)
+ options = append(options, remote.WithContext(ctx))
+ if s == nil || s.registryService == nil {
+ return options
+ }
+
+ registryHost, err := utilsregistry.GetRegistryAddress(imageRef)
+ if err != nil {
+ slog.DebugContext(ctx, "skipping registry auth for unparsable image ref", "image", imageRef, "error", err)
+ return options
+ }
+
+ encodedAuth, err := s.registryService.GetRegistryAuthForHost(ctx, registryHost)
+ if err != nil {
+ slog.DebugContext(ctx, "registry auth lookup failed for attestation request", "image", imageRef, "registry", registryHost, "error", err)
+ return options
+ }
+ if strings.TrimSpace(encodedAuth) == "" {
+ return options
+ }
+
+ dockerAuth, err := utilsregistry.DecodeAuthHeader(encodedAuth)
+ if err != nil {
+ slog.DebugContext(ctx, "registry auth decode failed for attestation request", "image", imageRef, "registry", registryHost, "error", err)
+ return options
+ }
+
+ options = append(options, remote.WithAuth(authn.FromConfig(authn.AuthConfig{
+ Username: dockerAuth.Username,
+ Password: dockerAuth.Password,
+ Auth: dockerAuth.Auth,
+ IdentityToken: dockerAuth.IdentityToken,
+ RegistryToken: dockerAuth.RegistryToken,
+ })))
+ return options
+}
+
+func imageAttestationSubjectsInternal(descriptor *remote.Descriptor, platform ocispec.Platform, hasPlatform bool) (v1.ImageIndex, []imageAttestationSubjectInternal, error) {
+ root := imageAttestationSubjectInternal{
+ Descriptor: descriptor.Descriptor,
+ Digest: descriptor.Digest.String(),
+ }
+ if !descriptor.MediaType.IsIndex() {
+ if hasPlatform {
+ root.Platform = platforms.Format(platform)
+ }
+ return nil, []imageAttestationSubjectInternal{root}, nil
+ }
+
+ index, err := descriptor.ImageIndex()
+ if err != nil {
+ return nil, nil, fmt.Errorf("read image index %s: %w", descriptor.Digest.String(), err)
+ }
+
+ indexManifest, err := index.IndexManifest()
+ if err != nil {
+ return nil, nil, fmt.Errorf("read image index manifest %s: %w", descriptor.Digest.String(), err)
+ }
+
+ subjects := make([]imageAttestationSubjectInternal, 0, len(indexManifest.Manifests)+1)
+ if !hasPlatform {
+ subjects = append(subjects, root)
+ }
+ for _, child := range indexManifest.Manifests {
+ if isInlineAttestationDescriptorInternal(child) {
+ continue
+ }
+ if hasPlatform && !platformDescriptorMatchesInternal(child.Platform, platform) {
+ continue
+ }
+ childPlatform := platformStringInternal(child.Platform)
+ if hasPlatform && childPlatform == "" {
+ childPlatform = platforms.Format(platform)
+ }
+ subjects = append(subjects, imageAttestationSubjectInternal{
+ Descriptor: child,
+ Digest: child.Digest.String(),
+ Platform: childPlatform,
+ })
+ }
+
+ return index, dedupeSubjectsInternal(subjects), nil
+}
+
+func platformDescriptorMatchesInternal(platform *v1.Platform, wanted ocispec.Platform) bool {
+ if platform == nil {
+ return false
+ }
+ candidate := ocispec.Platform{
+ Architecture: platform.Architecture,
+ OS: platform.OS,
+ OSVersion: platform.OSVersion,
+ OSFeatures: platform.OSFeatures,
+ Variant: platform.Variant,
+ }
+ return platforms.Only(wanted).Match(candidate)
+}
+
+func platformStringInternal(platform *v1.Platform) string {
+ if platform == nil || platform.OS == "" || platform.Architecture == "" {
+ return ""
+ }
+ return platforms.Format(ocispec.Platform{
+ Architecture: platform.Architecture,
+ OS: platform.OS,
+ OSVersion: platform.OSVersion,
+ OSFeatures: platform.OSFeatures,
+ Variant: platform.Variant,
+ })
+}
+
+func dedupeSubjectsInternal(subjects []imageAttestationSubjectInternal) []imageAttestationSubjectInternal {
+ seen := make(map[string]struct{}, len(subjects))
+ out := make([]imageAttestationSubjectInternal, 0, len(subjects))
+ for _, subject := range subjects {
+ if subject.Digest == "" {
+ continue
+ }
+ key := subject.Digest + "|" + subject.Platform
+ if _, ok := seen[key]; ok {
+ continue
+ }
+ seen[key] = struct{}{}
+ out = append(out, subject)
+ }
+ return out
+}
+
+func (s *ImageService) readReferrerAttestationsInternal(ctx context.Context, repository name.Repository, subject imageAttestationSubjectInternal, remoteOptions []remote.Option, query ImageAttestationQuery) ([]imagetypes.Attestation, error) {
+ referrers, err := remote.Referrers(repository.Digest(subject.Digest), remoteOptions...)
+ if err != nil {
+ if shouldIgnoreReferrersErrorInternal(err) {
+ return nil, nil
+ }
+ return nil, fmt.Errorf("query image referrers for %s: %w", subject.Digest, err)
+ }
+
+ manifest, err := referrers.IndexManifest()
+ if err != nil {
+ return nil, fmt.Errorf("read image referrers for %s: %w", subject.Digest, err)
+ }
+
+ attestations := make([]imagetypes.Attestation, 0, len(manifest.Manifests))
+ for _, referrer := range manifest.Manifests {
+ referrerDescriptor, err := remote.Get(repository.Digest(referrer.Digest.String()), remoteOptions...)
+ if err != nil {
+ return nil, fmt.Errorf("get image referrer %s: %w", referrer.Digest.String(), err)
+ }
+
+ referrerImage, err := referrerDescriptor.Image()
+ if err != nil {
+ continue
+ }
+
+ if referrer.ArtifactType == "" {
+ referrer.ArtifactType = referrerDescriptor.ArtifactType
+ }
+ if referrer.MediaType == "" {
+ referrer.MediaType = referrerDescriptor.MediaType
+ }
+
+ items, err := readAttestationImageInternal(ctx, referrerImage, referrer, subject.Platform, query)
+ if err != nil {
+ return nil, err
+ }
+ attestations = append(attestations, items...)
+ }
+ return attestations, nil
+}
+
+func shouldIgnoreReferrersErrorInternal(err error) bool {
+ var transportErr *transport.Error
+ if errors.As(err, &transportErr) {
+ return transportErr.StatusCode == http.StatusNotFound || transportErr.StatusCode == http.StatusMethodNotAllowed
+ }
+ return false
+}
+
+func readInlineAttestationsInternal(ctx context.Context, index v1.ImageIndex, subjects []imageAttestationSubjectInternal, query ImageAttestationQuery) ([]imagetypes.Attestation, error) {
+ if len(subjects) == 0 {
+ return nil, nil
+ }
+
+ indexManifest, err := index.IndexManifest()
+ if err != nil {
+ return nil, fmt.Errorf("read image index manifest for inline attestations: %w", err)
+ }
+
+ subjectByDigest := make(map[string]imageAttestationSubjectInternal, len(subjects))
+ for _, subject := range subjects {
+ subjectByDigest[subject.Digest] = subject
+ }
+
+ attestations := make([]imagetypes.Attestation, 0)
+ for _, descriptor := range indexManifest.Manifests {
+ if !isInlineAttestationDescriptorInternal(descriptor) {
+ continue
+ }
+
+ referenceDigest := strings.TrimSpace(descriptor.Annotations[attestationTypes.DockerAnnotationReferenceDigest])
+ subject, ok := subjectByDigest[referenceDigest]
+ if referenceDigest != "" && !ok {
+ continue
+ }
+ if referenceDigest == "" {
+ subject = firstSubjectInternal(subjects)
+ }
+
+ attestationImage, err := index.Image(descriptor.Digest)
+ if err != nil {
+ return nil, fmt.Errorf("read inline attestation image %s: %w", descriptor.Digest.String(), err)
+ }
+
+ items, err := readAttestationImageInternal(ctx, attestationImage, descriptor, subject.Platform, query)
+ if err != nil {
+ return nil, err
+ }
+ attestations = append(attestations, items...)
+ }
+ return attestations, nil
+}
+
+func firstSubjectInternal(subjects []imageAttestationSubjectInternal) imageAttestationSubjectInternal {
+ if len(subjects) == 0 {
+ return imageAttestationSubjectInternal{}
+ }
+ return subjects[0]
+}
+
+func isInlineAttestationDescriptorInternal(descriptor v1.Descriptor) bool {
+ if descriptor.Annotations[attestationTypes.DockerAnnotationReferenceType] == attestationTypes.DockerAnnotationReferenceTypeDefault {
+ return true
+ }
+ return descriptor.ArtifactType == dockerAttestationManifestArtifactTypeInternal
+}
+
+func readAttestationImageInternal(ctx context.Context, attestationImage v1.Image, artifactDescriptor v1.Descriptor, platform string, query ImageAttestationQuery) ([]imagetypes.Attestation, error) {
+ manifest, err := attestationImage.Manifest()
+ if err != nil {
+ return nil, fmt.Errorf("read attestation manifest %s: %w", artifactDescriptor.Digest.String(), err)
+ }
+
+ artifactType := artifactDescriptor.ArtifactType
+ if artifactType == "" {
+ artifactType = manifest.ArtifactType
+ }
+
+ attestations := make([]imagetypes.Attestation, 0, len(manifest.Layers))
+ for _, layerDescriptor := range manifest.Layers {
+ attestation, ok, err := readAttestationLayerInternal(ctx, attestationImage, layerDescriptor, artifactType, platform, query)
+ if err != nil {
+ return nil, err
+ }
+ if ok {
+ attestations = append(attestations, attestation)
+ }
+ }
+ return attestations, nil
+}
+
+func readAttestationLayerInternal(ctx context.Context, attestationImage v1.Image, layerDescriptor v1.Descriptor, artifactType, platform string, query ImageAttestationQuery) (imagetypes.Attestation, bool, error) {
+ if err := ctx.Err(); err != nil {
+ return imagetypes.Attestation{}, false, err
+ }
+ if layerDescriptor.MediaType != types.MediaType(inTotoLayerMediaTypeInternal) {
+ return imagetypes.Attestation{}, false, nil
+ }
+
+ annotationPredicate := strings.TrimSpace(layerDescriptor.Annotations[inTotoPredicateTypeAnnotationInternal])
+ if query.PredicateType != "" && annotationPredicate != "" && annotationPredicate != query.PredicateType {
+ return imagetypes.Attestation{}, false, nil
+ }
+
+ layer, err := attestationImage.LayerByDigest(layerDescriptor.Digest)
+ if err != nil {
+ return imagetypes.Attestation{}, false, fmt.Errorf("read attestation layer %s: %w", layerDescriptor.Digest.String(), err)
+ }
+
+ rawStatement, err := readAttestationLayerBytesInternal(layer, layerDescriptor.Digest.String())
+ if err != nil {
+ return imagetypes.Attestation{}, false, err
+ }
+
+ statement, err := parseAttestationStatementInternal(rawStatement)
+ if err != nil {
+ return imagetypes.Attestation{}, false, fmt.Errorf("parse attestation statement %s: %w", layerDescriptor.Digest.String(), err)
+ }
+ if statement.PredicateType == "" {
+ statement.PredicateType = annotationPredicate
+ }
+ if query.PredicateType != "" && statement.PredicateType != query.PredicateType {
+ return imagetypes.Attestation{}, false, nil
+ }
+
+ size := layerDescriptor.Size
+ if size == 0 {
+ size = int64(len(rawStatement))
+ }
+
+ attestation := imagetypes.Attestation{
+ Digest: layerDescriptor.Digest.String(),
+ MediaType: string(layerDescriptor.MediaType),
+ ArtifactType: artifactType,
+ PredicateType: statement.PredicateType,
+ StatementType: statement.Type,
+ Subject: statement.Subject,
+ Platform: platform,
+ Size: size,
+ }
+ if attestation.Subject == nil {
+ attestation.Subject = []imagetypes.AttestationSubject{}
+ }
+ if query.IncludeStatement {
+ attestation.Statement = append([]byte(nil), rawStatement...)
+ }
+ return attestation, true, nil
+}
+
+func readAttestationLayerBytesInternal(layer v1.Layer, digest string) ([]byte, error) {
+ reader, err := layer.Compressed()
+ if err != nil {
+ return nil, fmt.Errorf("open attestation layer %s: %w", digest, err)
+ }
+ rawStatement, readErr := io.ReadAll(reader)
+ closeErr := reader.Close()
+ if readErr != nil {
+ return nil, fmt.Errorf("read attestation layer %s: %w", digest, readErr)
+ }
+ if closeErr != nil {
+ return nil, fmt.Errorf("close attestation layer %s: %w", digest, closeErr)
+ }
+
+ statement, err := decompressAttestationStatementInternal(rawStatement)
+ if err != nil {
+ return nil, fmt.Errorf("decompress attestation layer %s: %w", digest, err)
+ }
+ return statement, nil
+}
+
+// decompressAttestationStatementInternal returns the raw in-toto statement
+// bytes, transparently decompressing OCI blobs that are stored compressed. The
+// in-toto media type does not encode the compression algorithm, so the
+// container is detected from the magic header. gzip and zstd are the algorithms
+// supported by the OCI image spec; anything else (including already
+// uncompressed JSON) is returned unchanged.
+func decompressAttestationStatementInternal(data []byte) ([]byte, error) {
+ switch {
+ case len(data) >= 2 && data[0] == 0x1f && data[1] == 0x8b:
+ reader, err := gzip.NewReader(bytes.NewReader(data))
+ if err != nil {
+ return nil, err
+ }
+ defer reader.Close()
+ return io.ReadAll(reader)
+ case len(data) >= 4 && data[0] == 0x28 && data[1] == 0xb5 && data[2] == 0x2f && data[3] == 0xfd:
+ reader, err := zstd.NewReader(nil)
+ if err != nil {
+ return nil, err
+ }
+ defer reader.Close()
+ return reader.DecodeAll(data, nil)
+ default:
+ return data, nil
+ }
+}
+
+func parseAttestationStatementInternal(rawStatement []byte) (attestationStatementEnvelopeInternal, error) {
+ var statement attestationStatementEnvelopeInternal
+ if err := json.Unmarshal(rawStatement, &statement); err != nil {
+ return attestationStatementEnvelopeInternal{}, err
+ }
+ return statement, nil
+}
+
+func dedupeAttestationsInternal(attestations []imagetypes.Attestation) []imagetypes.Attestation {
+ seen := make(map[string]struct{}, len(attestations))
+ out := make([]imagetypes.Attestation, 0, len(attestations))
+ for _, attestation := range attestations {
+ key := strings.Join([]string{
+ attestation.Digest,
+ attestation.PredicateType,
+ attestation.Platform,
+ }, "|")
+ if _, ok := seen[key]; ok {
+ continue
+ }
+ seen[key] = struct{}{}
+ out = append(out, attestation)
+ }
+ return out
+}
diff --git a/backend/internal/services/image_attestations_service_test.go b/backend/internal/services/image_attestations_service_test.go
new file mode 100644
index 000000000..5f1babe3a
--- /dev/null
+++ b/backend/internal/services/image_attestations_service_test.go
@@ -0,0 +1,68 @@
+package services
+
+import (
+ "bytes"
+ "compress/gzip"
+ "testing"
+
+ "github.com/google/go-containerregistry/pkg/v1/static"
+ "github.com/google/go-containerregistry/pkg/v1/types"
+ "github.com/klauspost/compress/zstd"
+)
+
+func TestReadAttestationLayerBytesInternalDecompressesGzip(t *testing.T) {
+ statement := []byte(`{"predicateType":"https://slsa.dev/provenance/v0.2"}`)
+
+ var buf bytes.Buffer
+ gz := gzip.NewWriter(&buf)
+ if _, err := gz.Write(statement); err != nil {
+ t.Fatalf("gzip write: %v", err)
+ }
+ if err := gz.Close(); err != nil {
+ t.Fatalf("gzip close: %v", err)
+ }
+
+ layer := static.NewLayer(buf.Bytes(), types.MediaType(inTotoLayerMediaTypeInternal))
+ got, err := readAttestationLayerBytesInternal(layer, "sha256:test")
+ if err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if !bytes.Equal(got, statement) {
+ t.Fatalf("expected decompressed statement %q, got %q", statement, got)
+ }
+}
+
+func TestReadAttestationLayerBytesInternalPassesThroughRawJSON(t *testing.T) {
+ statement := []byte(`{"predicateType":"https://spdx.dev/Document"}`)
+
+ layer := static.NewLayer(statement, types.MediaType(inTotoLayerMediaTypeInternal))
+ got, err := readAttestationLayerBytesInternal(layer, "sha256:test")
+ if err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if !bytes.Equal(got, statement) {
+ t.Fatalf("expected raw statement unchanged %q, got %q", statement, got)
+ }
+}
+
+func TestReadAttestationLayerBytesInternalDecompressesZstd(t *testing.T) {
+ statement := []byte(`{"predicateType":"https://slsa.dev/provenance/v1"}`)
+
+ encoder, err := zstd.NewWriter(nil)
+ if err != nil {
+ t.Fatalf("zstd writer: %v", err)
+ }
+ compressed := encoder.EncodeAll(statement, nil)
+ if err := encoder.Close(); err != nil {
+ t.Fatalf("zstd close: %v", err)
+ }
+
+ layer := static.NewLayer(compressed, types.MediaType(inTotoLayerMediaTypeInternal))
+ got, err := readAttestationLayerBytesInternal(layer, "sha256:test")
+ if err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if !bytes.Equal(got, statement) {
+ t.Fatalf("expected decompressed statement %q, got %q", statement, got)
+ }
+}
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index d93dc1e44..85e397731 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -735,6 +735,21 @@
"images_no_updates": "No Updates",
"images_tags_description": "Repository tags associated with this image",
"images_env_vars_description": "Environment variables defined in this image",
+ "images_attestations_title": "Attestations",
+ "images_attestations_loading": "Loading attestations…",
+ "images_attestations_lookup_failed": "Failed to load attestations",
+ "images_attestations_lookup_failed_description": "Registry lookup failed or the registry does not expose attestation referrers.",
+ "images_attestations_all_platforms": "All platforms",
+ "images_attestations_all_predicates": "All predicates",
+ "images_attestations_no_matches": "No attestations match the selected filters.",
+ "images_attestations_none_found": "No attestations found for this image.",
+ "images_attestations_digest": "Digest",
+ "images_attestations_statement_type": "Statement type",
+ "images_attestations_media_type": "Media type",
+ "images_attestations_predicate_type": "Predicate type",
+ "images_attestations_platform": "Platform",
+ "images_attestations_subject": "Subject",
+ "images_attestations_details_title": "Attestation details",
"images_pull_description": "Enter the image reference you want to pull from a registry.",
"images_image_name_label": "Image Name *",
"images_image_name_placeholder": "nginx, redis, ubuntu, etc.",
diff --git a/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte b/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte
index 3c4160439..213f4a313 100644
--- a/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte
+++ b/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte
@@ -1,5 +1,4 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card';
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import UniversalMobileCard from '$lib/components/arcane-table/cards/universal-mobile-card.svelte';
import { ArcaneButton } from '$lib/components/arcane-button';
@@ -12,7 +11,6 @@
import type { VulnerabilityScanResult, Vulnerability as VulnType } from '$lib/types/environment';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/shared';
import { ShieldCheckIcon, ShieldAlertIcon, ShieldXIcon, ScanIcon, CodeIcon, CheckIcon } from '$lib/icons';
- import { formatDateTime } from '$lib/utils/formatting';
import {
buildSeveritySummary,
getSeverityBadgeVariant,
@@ -156,11 +154,6 @@
return `${(durationMs / 1000).toFixed(1)} s`;
});
- const headerIcon = $derived.by(() => {
- const isClean = scan?.status === 'completed' && (resolvedSummary?.total ?? 0) === 0;
- return isClean ? ShieldCheckIcon : ShieldAlertIcon;
- });
-
const isWorking = $derived.by(() => isScanning || scan?.status === 'scanning');
const hasError = $derived.by(() => scan?.status === 'failed' || !!scan?.error);
@@ -311,137 +304,119 @@
/>
{/snippet}
-<Card.Root>
- <Card.Header icon={headerIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>{m.vuln_title()}</Card.Title>
- <Card.Description>
- {#if scan?.status === 'completed'}
- {m.vuln_scan_time()}: {scan ? formatDateTime(scan.scanTime) : m.common_na()}
- {:else if isWorking}
- {m.vuln_scanning()}
- {:else}
- {m.vuln_no_scan()}
+{#if isWorking}
+ <div class="flex items-center justify-center py-8">
+ <Spinner class="size-8" />
+ <span class="text-muted-foreground ml-3">{m.vuln_scanning()}</span>
+ </div>
+{:else if scan?.status === 'completed' && resolvedSummary}
+ {@const summary = resolvedSummary}
+ {#if summary.total === 0}
+ <div class="rounded-2xl border border-emerald-500/20 bg-emerald-500/5 p-6 shadow-sm">
+ <div class="flex items-center gap-4">
+ <div class="rounded-full bg-emerald-500/15 p-3">
+ <ShieldCheckIcon class="size-6 text-emerald-500" />
+ </div>
+ <div class="space-y-1">
+ <p class="text-xs font-semibold tracking-wide text-emerald-400 uppercase">{m.vuln_summary()}</p>
+ <p class="text-lg font-semibold text-emerald-200">{m.vuln_clean()}</p>
+ <p class="text-sm text-emerald-300/80">{m.vuln_no_vulnerabilities()}</p>
+ </div>
+ </div>
+ <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
+ <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
+ {#if scan?.scannerVersion}
+ <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
{/if}
- </Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-4">
- {#if isWorking}
- <div class="flex items-center justify-center py-8">
- <Spinner class="size-8" />
- <span class="text-muted-foreground ml-3">{m.vuln_scanning()}</span>
</div>
- {:else if scan?.status === 'completed' && resolvedSummary}
- {@const summary = resolvedSummary}
- {#if summary.total === 0}
- <div class="rounded-2xl border border-emerald-500/20 bg-emerald-500/5 p-6 shadow-sm">
- <div class="flex items-center gap-4">
- <div class="rounded-full bg-emerald-500/15 p-3">
- <ShieldCheckIcon class="size-6 text-emerald-500" />
- </div>
- <div class="space-y-1">
- <p class="text-xs font-semibold tracking-wide text-emerald-400 uppercase">{m.vuln_summary()}</p>
- <p class="text-lg font-semibold text-emerald-200">{m.vuln_clean()}</p>
- <p class="text-sm text-emerald-300/80">{m.vuln_no_vulnerabilities()}</p>
- </div>
- </div>
- <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
- <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
- {#if scan?.scannerVersion}
- <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
- {/if}
+ </div>
+ {:else}
+ <div class="grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]">
+ <div class="border-border/60 bg-muted/30 rounded-2xl border p-5 shadow-sm">
+ <div class="flex items-center justify-between">
+ <p class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">{m.vuln_summary()}</p>
+ <span class={`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ring-1 ${scanStatusTone}`}>
+ {scanStatusLabel}
+ </span>
+ </div>
+ <div class="mt-5 flex items-end gap-4">
+ <div class="text-5xl leading-none font-semibold tracking-tight">{summary.total}</div>
+ <div class="text-muted-foreground space-y-1 text-xs">
+ <div class="tracking-wide uppercase">{m.common_total()}</div>
+ <div>{m.vuln_details()}</div>
</div>
</div>
- {:else}
- <div class="grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]">
- <div class="border-border/60 bg-muted/30 rounded-2xl border p-5 shadow-sm">
- <div class="flex items-center justify-between">
- <p class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">{m.vuln_summary()}</p>
- <span class={`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ring-1 ${scanStatusTone}`}>
- {scanStatusLabel}
- </span>
- </div>
- <div class="mt-5 flex items-end gap-4">
- <div class="text-5xl leading-none font-semibold tracking-tight">{summary.total}</div>
- <div class="text-muted-foreground space-y-1 text-xs">
- <div class="tracking-wide uppercase">{m.common_total()}</div>
- <div>{m.vuln_details()}</div>
+ <div class="mt-5 space-y-2">
+ {#each severityBars as bar (bar.key)}
+ <div class="flex items-center gap-3 text-xs">
+ <span class="text-muted-foreground w-24">{bar.label}</span>
+ <div class="bg-muted/60 relative h-2 flex-1 overflow-hidden rounded-full">
+ <div class={`h-full ${bar.barClass}`} style={`width: ${bar.pct}%`}></div>
</div>
+ <span class={`w-8 text-right font-mono ${bar.textClass}`}>{bar.count}</span>
</div>
- <div class="mt-5 space-y-2">
- {#each severityBars as bar (bar.key)}
- <div class="flex items-center gap-3 text-xs">
- <span class="text-muted-foreground w-24">{bar.label}</span>
- <div class="bg-muted/60 relative h-2 flex-1 overflow-hidden rounded-full">
- <div class={`h-full ${bar.barClass}`} style={`width: ${bar.pct}%`}></div>
- </div>
- <span class={`w-8 text-right font-mono ${bar.textClass}`}>{bar.count}</span>
- </div>
- {/each}
- </div>
- <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
- <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
- {#if scan?.scannerVersion}
- <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
- {/if}
- </div>
- </div>
-
- <div class="grid gap-3 sm:grid-cols-2">
- {#each severityBars as bar (bar.key)}
- <div class="border-border/60 bg-muted/30 rounded-xl border p-4 shadow-sm">
- <div class="flex items-center justify-between">
- <span class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">{bar.label}</span>
- </div>
- <div class={`mt-2 text-3xl font-semibold ${bar.textClass}`}>{bar.count}</div>
- <div class="bg-muted/60 mt-3 h-1.5 rounded-full">
- <div class={`h-full ${bar.barClass}`} style={`width: ${bar.pct}%`}></div>
- </div>
- </div>
- {/each}
- </div>
+ {/each}
</div>
- {/if}
+ <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
+ <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
+ {#if scan?.scannerVersion}
+ <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
+ {/if}
+ </div>
+ </div>
- {#if resolvedSummary && resolvedSummary.total > 0}
- <div class="mt-6 space-y-2">
- <h4 class="text-muted-foreground text-sm font-semibold">{m.vuln_details()}</h4>
- <div class="border-border/60 rounded-xl border">
- <ArcaneTable
- items={vulnerabilityItems}
- bind:requestOptions={vulnerabilityRequestOptions}
- onRefresh={refreshVulnerabilityTable}
- {columns}
- mobileCard={VulnerabilityMobileCard}
- {mobileFields}
- selectionDisabled
- unstyled
- />
+ <div class="grid gap-3 sm:grid-cols-2">
+ {#each severityBars as bar (bar.key)}
+ <div class="border-border/60 bg-muted/30 rounded-xl border p-4 shadow-sm">
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">{bar.label}</span>
+ </div>
+ <div class={`mt-2 text-3xl font-semibold ${bar.textClass}`}>{bar.count}</div>
+ <div class="bg-muted/60 mt-3 h-1.5 rounded-full">
+ <div class={`h-full ${bar.barClass}`} style={`width: ${bar.pct}%`}></div>
+ </div>
</div>
- </div>
- {/if}
- {:else if hasError}
- <div class="flex items-center gap-3 rounded-lg bg-red-50 p-4 dark:bg-red-950/20">
- <ShieldXIcon class="size-8 text-red-500" />
- <div>
- <p class="font-medium text-red-800 dark:text-red-200">{m.vuln_scan_failed()}</p>
- <p class="text-sm text-red-600 dark:text-red-400">{scan?.error || m.vuln_scanner_not_installed()}</p>
- </div>
+ {/each}
</div>
- {:else}
- <div class="flex flex-col items-center justify-center py-8 text-center">
- <ScanIcon class="text-muted-foreground/50 mb-4 size-12" />
- <p class="text-muted-foreground mb-2">{m.vuln_no_scan()}</p>
- <ArcaneButton action="base" onclick={onScan} disabled={!onScan || isScanning}>
- {#if isScanning}
- <Spinner class="mr-2 size-4" />
- {:else}
- <ScanIcon class="mr-2 size-4" />
- {/if}
- {m.vuln_scan_image()}
- </ArcaneButton>
+ </div>
+ {/if}
+
+ {#if resolvedSummary && resolvedSummary.total > 0}
+ <div class="mt-6 space-y-2">
+ <h4 class="text-muted-foreground text-sm font-semibold">{m.vuln_details()}</h4>
+ <div class="border-border/60 rounded-xl border">
+ <ArcaneTable
+ items={vulnerabilityItems}
+ bind:requestOptions={vulnerabilityRequestOptions}
+ onRefresh={refreshVulnerabilityTable}
+ {columns}
+ mobileCard={VulnerabilityMobileCard}
+ {mobileFields}
+ selectionDisabled
+ unstyled
+ />
</div>
- {/if}
- </Card.Content>
-</Card.Root>
+ </div>
+ {/if}
+{:else if hasError}
+ <div class="flex items-center gap-3 rounded-lg bg-red-50 p-4 dark:bg-red-950/20">
+ <ShieldXIcon class="size-8 text-red-500" />
+ <div>
+ <p class="font-medium text-red-800 dark:text-red-200">{m.vuln_scan_failed()}</p>
+ <p class="text-sm text-red-600 dark:text-red-400">{scan?.error || m.vuln_scanner_not_installed()}</p>
+ </div>
+ </div>
+{:else}
+ <div class="flex flex-col items-center justify-center py-8 text-center">
+ <ScanIcon class="text-muted-foreground/50 mb-4 size-12" />
+ <p class="text-muted-foreground mb-2">{m.vuln_no_scan()}</p>
+ <ArcaneButton action="base" onclick={onScan} disabled={!onScan || isScanning}>
+ {#if isScanning}
+ <Spinner class="mr-2 size-4" />
+ {:else}
+ <ScanIcon class="mr-2 size-4" />
+ {/if}
+ {m.vuln_scan_image()}
+ </ArcaneButton>
+ </div>
+{/if}
diff --git a/frontend/src/lib/services/image-service.ts b/frontend/src/lib/services/image-service.ts
index 7c6facc89..7be1bacb3 100644
--- a/frontend/src/lib/services/image-service.ts
+++ b/frontend/src/lib/services/image-service.ts
@@ -1,6 +1,13 @@
import BaseAPIService from './api-service';
import { environmentStore } from '$lib/stores/environment.store.svelte';
-import type { ImageSummaryDto, ImageUsageCounts, ImageUpdateInfoDto, ImageBuildRecord } from '$lib/types/docker';
+import type {
+ ImageSummaryDto,
+ ImageUsageCounts,
+ ImageUpdateInfoDto,
+ ImageBuildRecord,
+ ImageAttestationListDto,
+ ImageAttestationRequestOptions
+} from '$lib/types/docker';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/shared';
import type { AutoUpdateCheck, AutoUpdateResult } from '$lib/types/automation';
import type { PruneImagesOptions } from '$lib/types/automation';
@@ -44,6 +51,23 @@ class ImageService extends BaseAPIService {
return this.handleResponse(this.api.get(`/environments/${environmentId}/images/${imageId}`));
}
+ async getImageAttestationsForEnvironment(
+ environmentId: string,
+ imageId: string,
+ options?: ImageAttestationRequestOptions
+ ): Promise<ImageAttestationListDto> {
+ const params: Record<string, string> = {};
+ if (options?.platform) params['platform'] = options.platform;
+ if (options?.predicateType) params['predicateType'] = options.predicateType;
+ if (options?.statement) params['statement'] = 'true';
+
+ return this.handleResponse(
+ this.api.get(`/environments/${environmentId}/images/${imageId}/attestations`, {
+ params
+ })
+ );
+ }
+
async pullImage(imageName: string, tag: string = 'latest', auth?: any): Promise<any> {
const envId = await environmentStore.getCurrentEnvironmentId();
return this.handleResponse(this.api.post(`/environments/${envId}/images/pull`, { imageName, tag, auth }));
diff --git a/frontend/src/lib/stores/dashboard.store.svelte.ts b/frontend/src/lib/stores/dashboard.store.svelte.ts
index c27fa0347..975f39d2d 100644
--- a/frontend/src/lib/stores/dashboard.store.svelte.ts
+++ b/frontend/src/lib/stores/dashboard.store.svelte.ts
@@ -197,7 +197,9 @@ function createDashboardStore() {
async function refreshInternal(generation = streamGeneration) {
reconcileEnvironmentsInternal();
- await Promise.all(Object.keys(_environmentStates).map((environmentId) => refreshEnvironmentInternal(environmentId, generation)));
+ await Promise.all(
+ Object.keys(_environmentStates).map((environmentId) => refreshEnvironmentInternal(environmentId, generation))
+ );
}
async function connectStreamInternal(generation: number) {
diff --git a/frontend/src/lib/types/docker.ts b/frontend/src/lib/types/docker.ts
index abfde38e8..f2b07e721 100644
--- a/frontend/src/lib/types/docker.ts
+++ b/frontend/src/lib/types/docker.ts
@@ -415,6 +415,36 @@ export interface ImageDetailSummaryDto {
};
}
+export interface ImageAttestationSubjectDto {
+ name: string;
+ digest: Record<string, string>;
+}
+
+export interface ImageAttestationDto {
+ digest: string;
+ mediaType: string;
+ artifactType?: string;
+ predicateType: string;
+ statementType?: string;
+ subject: ImageAttestationSubjectDto[];
+ platform?: string;
+ size: number;
+ statement?: unknown;
+}
+
+export interface ImageAttestationListDto {
+ imageRef: string;
+ subjectDigest: string;
+ platform?: string;
+ attestations: ImageAttestationDto[];
+}
+
+export interface ImageAttestationRequestOptions {
+ platform?: string;
+ predicateType?: string;
+ statement?: boolean;
+}
+
export type ImageUpdateData = ImageUpdateInfoDto;
export type ImageBuildStatus = 'running' | 'success' | 'failed';
diff --git a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
index 629af0502..c7934cb82 100644
--- a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
+++ b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
@@ -1,5 +1,3 @@
-
-
<script lang="ts">
import { goto, invalidateAll } from '$app/navigation';
import { resolve } from '$app/paths';
@@ -26,7 +24,8 @@
DashboardEnvironmentCardState,
DashboardEnvironmentOverview,
DashboardOverviewSummary,
- DashboardSnapshot
+ DashboardSnapshot,
+ SystemStats
} from '$lib/types/shared';
import type { Environment } from '$lib/types/environment';
import type { DockerInfo } from '$lib/types/docker';
@@ -779,12 +778,7 @@
{#if boardSummaryLoading}
<div class="grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-4">
- {#each [
- { icon: EnvironmentsIcon, label: m.environments_title() },
- { icon: ContainersIcon, label: m.containers_title() },
- { icon: ImagesIcon, label: m.images_title() },
- { icon: VolumesIcon, label: m.dashboard_all_storage_title() }
- ] as tile (tile.label)}
+ {#each [{ icon: EnvironmentsIcon, label: m.environments_title() }, { icon: ContainersIcon, label: m.containers_title() }, { icon: ImagesIcon, label: m.images_title() }, { icon: VolumesIcon, label: m.dashboard_all_storage_title() }] as tile (tile.label)}
<div class="border-border/50 bg-background/50 rounded-xl border p-3">
<div class="text-muted-foreground flex items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase">
<tile.icon class="size-3.5" />
diff --git a/frontend/src/routes/(app)/images/[imageId]/+page.svelte b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
index a7195d287..0202db029 100644
--- a/frontend/src/routes/(app)/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card';
+ import * as Tabs from '$lib/components/ui/tabs/index.js';
import { goto } from '$app/navigation';
import { Badge } from '$lib/components/ui/badge';
import { format } from 'date-fns';
@@ -20,16 +21,20 @@
isVulnerabilityScanInProgress
} from '$lib/utils/docker';
import { ResourceDetailLayout, type DetailAction } from '$lib/layouts';
+ import ImageAttestationsPanel from './image-attestations-panel.svelte';
import VulnerabilityScanPanel from '$lib/components/vulnerability/vulnerability-scan-panel.svelte';
import type { VulnerabilityScanResult } from '$lib/types/environment';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { hasPermission } from '$lib/utils/auth';
import { toastVulnerabilityScanStatus } from '$lib/utils/vulnerability';
- import { VolumesIcon, ClockIcon, TagIcon, LayersIcon, CpuIcon, InfoIcon, SettingsIcon, HashIcon } from '$lib/icons';
+ import { VolumesIcon, ClockIcon, TagIcon, CpuIcon, ShieldCheckIcon } from '$lib/icons';
+ import { cn } from '$lib/utils';
let { data } = $props();
let { image } = $derived(data);
+ let securityTab = $state('attestations');
+
const currentEnvId = $derived(environmentStore.selected?.id || '0');
const canDeleteImage = $derived(hasPermission('images:delete', currentEnvId));
const canScanImage = $derived(hasPermission('vulnerabilities:scan', currentEnvId));
@@ -254,170 +259,96 @@
});
</script>
-<ResourceDetailLayout
- backUrl="/images"
- backLabel={m.images_title()}
- title={image?.repoTags?.[0] || shortId}
- subtitle={shortId}
- {actions}
->
+<ResourceDetailLayout backUrl="/images" backLabel={m.images_title()} title={image?.repoTags?.[0] || shortId} {actions}>
{#if image}
<div class="space-y-6">
- {#if hasTags}
- <div class="border-border/60 bg-muted/30 rounded-xl border px-4 py-3">
- <div class="flex flex-wrap items-center gap-2">
- <span class="text-muted-foreground inline-flex items-center gap-2 text-xs font-semibold tracking-wide uppercase">
- <TagIcon class="size-4" />
- {m.common_tags()}
- </span>
- {#each repoTags as tag (tag)}
- <Badge variant="secondary" class="cursor-pointer text-xs select-all" title="Click to select">
- {tag}
- </Badge>
- {/each}
- </div>
- </div>
- {/if}
-
- <Card.Root>
- <Card.Header icon={InfoIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>{m.common_details_title({ resource: m.resource_image_cap() })}</Card.Title>
- <Card.Description>{m.common_details_description({ resource: m.resource_image() })}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-5">
- <div class="grid gap-3 sm:grid-cols-2">
- <div class="border-border/60 bg-muted/30 rounded-2xl border p-4 sm:col-span-2">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold tracking-wide uppercase">
- <HashIcon class="text-muted-foreground size-4" />
- {m.common_id()}
- </div>
- <p
- class="mt-2 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm"
- title="Click to select"
- >
- {image?.id || m.common_na()}
- </p>
- </div>
-
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <VolumesIcon class="size-4 text-blue-500" />
- {m.common_size()}
- </div>
- <p class="mt-2 cursor-pointer text-sm font-semibold select-all" title="Click to select">{imageSize}</p>
- </div>
-
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <ClockIcon class="size-4 text-green-500" />
- {m.common_created()}
- </div>
- <p class="mt-2 cursor-pointer text-sm font-semibold select-all" title="Click to select">{createdDate}</p>
- </div>
-
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <CpuIcon class="size-4 text-orange-500" />
- {m.common_architecture()}
- </div>
- <p class="mt-2 cursor-pointer text-sm font-semibold select-all" title="Click to select">{architecture}</p>
+ {#snippet tile(label: string, value: string, opts?: { mono?: boolean; class?: string })}
+ <Card.Root variant="subtle" class={opts?.class}>
+ <Card.Content class="flex flex-col gap-1 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">{label}</div>
+ <div class={cn('text-foreground text-sm font-medium', opts?.mono && 'font-mono break-all select-all')}>
+ {value}
</div>
+ </Card.Content>
+ </Card.Root>
+ {/snippet}
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <LayersIcon class="size-4 text-indigo-500" />
- {m.images_os()}
- </div>
- <p class="mt-2 cursor-pointer text-sm font-semibold select-all" title="Click to select">{osName}</p>
- </div>
+ <div class="bg-muted/40 flex flex-wrap items-center gap-x-4 gap-y-2 rounded-lg px-4 py-3">
+ <div class="text-muted-foreground flex items-center gap-1.5 text-sm">
+ <VolumesIcon class="size-4 shrink-0" />
+ <span>{imageSize}</span>
+ </div>
+ <div class="text-muted-foreground flex items-center gap-1.5 text-sm">
+ <ClockIcon class="size-4 shrink-0" />
+ <span>{createdDate}</span>
+ </div>
+ <div class="text-muted-foreground flex items-center gap-1.5 text-sm">
+ <CpuIcon class="size-4 shrink-0" />
+ <span>{architecture} · {osName}</span>
+ </div>
+ </div>
- {#if image?.dockerVersion}
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <InfoIcon class="size-4 text-purple-500" />
- {m.common_docker_version()}
- </div>
- <p class="mt-2 cursor-pointer text-sm font-semibold select-all" title="Click to select">
- {image.dockerVersion}
- </p>
- </div>
- {/if}
+ {#if hasTags}
+ <div class="flex flex-wrap items-center gap-2">
+ <span class="text-muted-foreground inline-flex items-center gap-2 text-xs font-semibold tracking-wide uppercase">
+ <TagIcon class="size-4" />
+ {m.common_tags()}
+ </span>
+ {#each repoTags as tag (tag)}
+ <Badge variant="secondary" class="cursor-pointer text-xs select-all" title="Click to select">
+ {tag}
+ </Badge>
+ {/each}
+ </div>
+ {/if}
- {#if image?.author}
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <InfoIcon class="size-4 text-pink-500" />
- {m.common_author()}
- </div>
- <p class="mt-2 cursor-pointer text-sm font-semibold break-all select-all" title="Click to select">
- {image.author}
- </p>
- </div>
- {/if}
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">
+ {@render tile(m.common_id(), image?.id || m.common_na(), { mono: true, class: 'sm:col-span-2 lg:col-span-3' })}
+ {#if image?.dockerVersion}
+ {@render tile(m.common_docker_version(), image.dockerVersion)}
+ {/if}
+ {#if image?.author}
+ {@render tile(m.common_author(), image.author)}
+ {/if}
+ {#if image.config?.workingDir}
+ {@render tile(m.common_working_dir(), image.config.workingDir, { mono: true })}
+ {/if}
+ </div>
- {#if image.config?.workingDir}
- <div class="border-border/60 bg-muted/30 rounded-xl border p-3 sm:col-span-2">
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold">
- <InfoIcon class="size-4 text-amber-500" />
- {m.common_working_dir()}
- </div>
- <p
- class="mt-2 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm"
- title="Click to select"
- >
- {image.config.workingDir}
- </p>
- </div>
- {/if}
+ {#if hasEnv}
+ <div class="space-y-4 border-t pt-6">
+ <h3 class="text-sm font-medium">{m.common_environment_variables()}</h3>
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ {#each envVars as env (env)}
+ {#if env.includes('=')}
+ {@const [key, ...valueParts] = env.split('=')}
+ {@render tile(key ?? '', valueParts.join('='), { mono: true })}
+ {:else}
+ {@render tile('ENV_VAR', env, { mono: true })}
+ {/if}
+ {/each}
</div>
+ </div>
+ {/if}
- {#if hasEnv}
- <div class="border-border/60 bg-muted/30 mt-4 rounded-2xl border p-4">
- <div class="flex flex-wrap items-start justify-between gap-3">
- <div>
- <div class="text-muted-foreground flex items-center gap-2 text-xs font-semibold tracking-wide uppercase">
- <SettingsIcon class="size-4" />
- {m.common_environment_variables()}
- </div>
- </div>
- </div>
- <div class="mt-4 grid grid-cols-1 gap-2 sm:grid-cols-2">
- {#each envVars as env (env)}
- {#if env.includes('=')}
- {@const [key, ...valueParts] = env.split('=')}
- {@const value = valueParts.join('=')}
- <div class="border-border/50 bg-muted/20 rounded-lg border px-3 py-2">
- <div class="text-muted-foreground text-[11px] font-semibold tracking-wide break-all uppercase">
- {key}
- </div>
- <div
- class="text-foreground mt-1 cursor-pointer font-mono text-xs font-medium break-all select-all"
- title="Click to select"
- >
- {value}
- </div>
- </div>
- {:else}
- <div class="border-border/50 bg-muted/20 rounded-lg border px-3 py-2">
- <div class="text-muted-foreground text-[11px] font-semibold tracking-wide uppercase">ENV_VAR</div>
- <div
- class="text-foreground mt-1 cursor-pointer font-mono text-xs font-medium break-all select-all"
- title="Click to select"
- >
- {env}
- </div>
- </div>
- {/if}
- {/each}
- </div>
- </div>
- {/if}
- </Card.Content>
- </Card.Root>
-
- <VulnerabilityScanPanel scan={vulnerabilityScan} isScanning={isLoading.scanning} onScan={handleScanImage} />
+ <div class="space-y-4 border-t pt-6">
+ <h3 class="flex items-center gap-2 text-sm font-medium">
+ <ShieldCheckIcon class="size-4" />
+ {m.security_title()}
+ </h3>
+ <Tabs.Root bind:value={securityTab} class="space-y-4">
+ <Tabs.List>
+ <Tabs.Trigger value="attestations">{m.images_attestations_title()}</Tabs.Trigger>
+ <Tabs.Trigger value="vulnerabilities">{m.vuln_title()}</Tabs.Trigger>
+ </Tabs.List>
+ <Tabs.Content value="attestations">
+ <ImageAttestationsPanel {image} />
+ </Tabs.Content>
+ <Tabs.Content value="vulnerabilities">
+ <VulnerabilityScanPanel scan={vulnerabilityScan} isScanning={isLoading.scanning} onScan={handleScanImage} />
+ </Tabs.Content>
+ </Tabs.Root>
+ </div>
</div>
{:else}
<div class="py-12 text-center">
diff --git a/frontend/src/routes/(app)/images/[imageId]/image-attestations-panel.svelte b/frontend/src/routes/(app)/images/[imageId]/image-attestations-panel.svelte
new file mode 100644
index 000000000..7fa624dce
--- /dev/null
+++ b/frontend/src/routes/(app)/images/[imageId]/image-attestations-panel.svelte
@@ -0,0 +1,194 @@
+<script lang="ts">
+ import { ResponsiveDialog } from '$lib/components/ui/responsive-dialog/index.js';
+ import * as Select from '$lib/components/ui/select/index.js';
+ import { Badge } from '$lib/components/ui/badge';
+ import { Spinner } from '$lib/components/ui/spinner';
+ import { ArrowRightIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+ import { imageService } from '$lib/services/image-service';
+ import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import type { ImageAttestationDto, ImageAttestationListDto, ImageDetailSummaryDto } from '$lib/types/docker';
+ import { bytes } from '$lib/utils/formatting';
+
+ const ALL_FILTER = '__all__';
+
+ let { image }: { image: ImageDetailSummaryDto } = $props();
+
+ const envId = $derived(environmentStore.selected?.id || '0');
+ let selectedPlatform = $state(ALL_FILTER);
+ let selectedPredicateType = $state(ALL_FILTER);
+ let detailsOpen = $state(false);
+ let selectedAttestation = $state<ImageAttestationDto | null>(null);
+
+ function openDetails(attestation: ImageAttestationDto) {
+ selectedAttestation = attestation;
+ detailsOpen = true;
+ }
+
+ const requestOptions = $derived.by(() => ({
+ platform: selectedPlatform === ALL_FILTER ? undefined : selectedPlatform,
+ predicateType: selectedPredicateType === ALL_FILTER ? undefined : selectedPredicateType
+ }));
+
+ const attestationsPromise = $derived.by(() => {
+ if (!image.id || !envId) {
+ return Promise.resolve(emptyAttestationList());
+ }
+ return imageService.getImageAttestationsForEnvironment(envId, image.id, requestOptions);
+ });
+ const hasActiveFilter = $derived(selectedPlatform !== ALL_FILTER || selectedPredicateType !== ALL_FILTER);
+ const selectedPlatformLabel = $derived(
+ selectedPlatform === ALL_FILTER ? m.images_attestations_all_platforms() : selectedPlatform
+ );
+ const selectedPredicateLabel = $derived(
+ selectedPredicateType === ALL_FILTER ? m.images_attestations_all_predicates() : selectedPredicateType
+ );
+
+ function filterOptions(values: Array<string | undefined>, selected: string): string[] {
+ const options = values.filter((value): value is string => Boolean(value));
+ if (selected !== ALL_FILTER) {
+ options.push(selected);
+ }
+ return options.filter((value, index) => options.indexOf(value) === index).sort();
+ }
+
+ function subjectLabel(attestation: ImageAttestationDto): string {
+ if (!attestation.subject.length) return m.common_na();
+ return attestation.subject.map((subject) => subject.name || Object.values(subject.digest).join(', ')).join(', ');
+ }
+
+ function emptyAttestationList(): ImageAttestationListDto {
+ return {
+ imageRef: image.id,
+ subjectDigest: '',
+ attestations: []
+ };
+ }
+</script>
+
+<div class="space-y-4">
+ {#await attestationsPromise}
+ <div class="flex items-center justify-center py-8">
+ <Spinner class="size-7" />
+ <span class="text-muted-foreground ml-3 text-sm">{m.images_attestations_loading()}</span>
+ </div>
+ {:then data}
+ {@const attestations = data.attestations}
+ {@const knownPlatforms = filterOptions(
+ attestations.map((attestation) => attestation.platform),
+ selectedPlatform
+ )}
+ {@const knownPredicateTypes = filterOptions(
+ attestations.map((attestation) => attestation.predicateType),
+ selectedPredicateType
+ )}
+ <div class="flex flex-wrap items-center gap-3">
+ <Select.Root type="single" bind:value={selectedPlatform}>
+ <Select.Trigger size="sm" class="w-full sm:w-[180px]">
+ <span class="truncate">{selectedPlatformLabel}</span>
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value={ALL_FILTER}>{m.images_attestations_all_platforms()}</Select.Item>
+ {#each knownPlatforms as platform (platform)}
+ <Select.Item value={platform}>{platform}</Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+
+ <Select.Root type="single" bind:value={selectedPredicateType}>
+ <Select.Trigger size="sm" class="w-full sm:w-[280px]">
+ <span class="truncate">{selectedPredicateLabel}</span>
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value={ALL_FILTER}>{m.images_attestations_all_predicates()}</Select.Item>
+ {#each knownPredicateTypes as predicateType (predicateType)}
+ <Select.Item value={predicateType}>
+ <span class="font-mono text-xs">{predicateType}</span>
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ </div>
+
+ {#if attestations.length === 0}
+ <div class="text-muted-foreground bg-muted/40 rounded-lg p-4 text-sm">
+ {#if hasActiveFilter}
+ {m.images_attestations_no_matches()}
+ {:else}
+ {m.images_attestations_none_found()}
+ {/if}
+ </div>
+ {:else}
+ <div class="border-border/60 divide-border/60 divide-y overflow-hidden rounded-lg border">
+ {#each attestations as attestation (attestation.digest + attestation.predicateType + (attestation.platform ?? ''))}
+ <button
+ type="button"
+ onclick={() => openDetails(attestation)}
+ class="hover:bg-muted/40 flex w-full items-center gap-3 px-4 py-3 text-left transition-colors"
+ >
+ <span class="min-w-0 flex-1 truncate font-mono text-xs font-semibold">{attestation.predicateType}</span>
+ {#if attestation.platform}
+ <Badge variant="outline" class="shrink-0">{attestation.platform}</Badge>
+ {/if}
+ <ArrowRightIcon class="text-muted-foreground size-4 shrink-0" />
+ </button>
+ {/each}
+ </div>
+ {/if}
+ {:catch}
+ <div class="bg-muted/40 rounded-lg p-4">
+ <p class="text-sm font-medium">{m.images_attestations_lookup_failed()}</p>
+ <p class="text-muted-foreground mt-1 text-xs">{m.images_attestations_lookup_failed_description()}</p>
+ </div>
+ {/await}
+
+ <ResponsiveDialog bind:open={detailsOpen} title={m.images_attestations_details_title()} contentClass="sm:max-w-2xl">
+ {#if selectedAttestation}
+ {@const attestation = selectedAttestation}
+ <div class="space-y-4 pb-6">
+ <div class="grid gap-3 sm:grid-cols-2">
+ <div>
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.images_attestations_predicate_type()}
+ </div>
+ <p class="mt-1 font-mono text-xs break-all">{attestation.predicateType}</p>
+ </div>
+ <div>
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.images_attestations_platform()}
+ </div>
+ <p class="mt-1 text-xs">{attestation.platform || m.common_na()}</p>
+ </div>
+ <div>
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.images_attestations_statement_type()}
+ </div>
+ <p class="mt-1 font-mono text-xs break-all">{attestation.statementType || m.common_na()}</p>
+ </div>
+ <div>
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.images_attestations_media_type()}
+ </div>
+ <p class="mt-1 font-mono text-xs break-all">{attestation.mediaType}</p>
+ </div>
+ <div>
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">{m.common_size()}</div>
+ <p class="mt-1 text-xs font-medium">{bytes.format(attestation.size)}</p>
+ </div>
+ <div class="sm:col-span-2">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.images_attestations_digest()}
+ </div>
+ <p class="mt-1 font-mono text-xs break-all select-all">{attestation.digest}</p>
+ </div>
+ <div class="sm:col-span-2">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.images_attestations_subject()}
+ </div>
+ <p class="mt-1 font-mono text-xs break-all">{subjectLabel(attestation)}</p>
+ </div>
+ </div>
+ </div>
+ {/if}
+ </ResponsiveDialog>
+</div>
diff --git a/types/image/image.go b/types/image/image.go
index 931529118..832771304 100644
--- a/types/image/image.go
+++ b/types/image/image.go
@@ -1,6 +1,7 @@
package image
import (
+ "encoding/json"
"math"
"strings"
"time"
@@ -161,6 +162,30 @@ type Summary struct {
VulnerabilityScan *vulnerability.ScanSummary `json:"vulnerabilityScan,omitempty"`
}
+type AttestationList struct {
+ ImageRef string `json:"imageRef"`
+ SubjectDigest string `json:"subjectDigest"`
+ Platform string `json:"platform,omitempty"`
+ Attestations []Attestation `json:"attestations"`
+}
+
+type Attestation struct {
+ Digest string `json:"digest"`
+ MediaType string `json:"mediaType"`
+ ArtifactType string `json:"artifactType,omitempty"`
+ PredicateType string `json:"predicateType"`
+ StatementType string `json:"statementType,omitempty"`
+ Subject []AttestationSubject `json:"subject"`
+ Platform string `json:"platform,omitempty"`
+ Size int64 `json:"size"`
+ Statement json.RawMessage `json:"statement,omitempty"`
+}
+
+type AttestationSubject struct {
+ Name string `json:"name"`
+ Digest map[string]string `json:"digest"`
+}
+
type PruneReport struct {
// ImagesDeleted is a list of image IDs that were deleted.
//
@@ -553,7 +578,6 @@ func NewDetailSummary(src *image.InspectResponse) DetailSummary {
}
}
out.Config.WorkingDir = src.Config.WorkingDir
- //nolint:staticcheck // SA1019: deprecated field intentionally copied for Docker Windows image compatibility
out.Config.ArgsEscaped = src.Config.ArgsEscaped
}