diff --git a/adapters/v1/domain_to_armo.go b/adapters/v1/domain_to_armo.go index ad2da43..126c997 100644 --- a/adapters/v1/domain_to_armo.go +++ b/adapters/v1/domain_to_armo.go @@ -2,7 +2,6 @@ package v1 import ( "context" - "encoding/base64" "encoding/json" "strings" @@ -223,26 +222,21 @@ func parseImageManifest(sbom domain.SBOM) (*containerscan.ImageManifest, error) if sbom.Content == nil { return nil, nil } - - var rawManifest domain.RawImageManifest + var rawManifest source.ImageMetadata if err := json.Unmarshal(sbom.Content.SyftSource.Metadata, &rawManifest); err != nil { return nil, err } - configData, err := base64.StdEncoding.DecodeString(rawManifest.Config) + var config v1.ConfigFile + err := json.Unmarshal(rawManifest.RawConfig, &config) if err != nil { return nil, err } - var config domain.ImageConfig - if err := json.Unmarshal(configData, &config); err != nil { - return nil, err - } - imageManifest := containerscan.ImageManifest{ Architecture: config.Architecture, OS: config.OS, - Size: rawManifest.ImageSize, + Size: rawManifest.Size, Layers: []containerscan.ESLayer{}, } @@ -251,7 +245,7 @@ func parseImageManifest(sbom domain.SBOM) (*containerscan.ImageManifest, error) layerInfo := containerscan.ESLayer{ LayerInfo: &containerscan.LayerInfo{ CreatedBy: historyLayer.CreatedBy, - CreatedTime: &historyLayer.Created, + CreatedTime: &historyLayer.Created.Time, LayerOrder: i, }, } diff --git a/core/domain/image.go b/core/domain/image.go deleted file mode 100644 index ddd9f85..0000000 --- a/core/domain/image.go +++ /dev/null @@ -1,28 +0,0 @@ -package domain - -import "time" - -type RawImageManifest struct { - Config string `json:"config"` - ImageID string `json:"imageID"` - ManifestDigest string `json:"manifestDigest"` - ImageSize int64 `json:"imageSize"` - Layers []ImageLayer `json:"layers"` -} - -type ImageConfig struct { - Architecture string `json:"architecture"` - OS string `json:"os"` - History []ImageHistory `json:"history"` -} - -type ImageHistory struct { - Created time.Time `json:"created"` - CreatedBy string `json:"created_by"` - EmptyLayer bool `json:"empty_layer"` -} - -type ImageLayer struct { - Digest string `json:"digest"` - Size int64 `json:"size"` -}