From e640089bf542d6235f0fb20e2615c2d9af63da77 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Wed, 27 Sep 2023 15:03:13 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20platformID=20for=20con?= =?UTF-8?q?tainers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian Zunker --- providers/os/connection/docker_container.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/providers/os/connection/docker_container.go b/providers/os/connection/docker_container.go index 4326f32648..4008c3859b 100644 --- a/providers/os/connection/docker_container.go +++ b/providers/os/connection/docker_container.go @@ -255,7 +255,8 @@ func NewDockerEngineContainer(id uint32, conf *inventory.Config, asset *inventor conn.PlatformIdentifier = containerid.MondooContainerID(ci.ID) conn.Metadata.Name = containerid.ShortContainerImageID(ci.ID) conn.Metadata.Labels = ci.Labels - conn.Asset().Name = ci.Name + asset.Name = ci.Name + asset.PlatformIds = []string{containerid.MondooContainerID(ci.ID)} return conn, nil } else { log.Debug().Msg("found stopped container " + ci.ID) @@ -268,7 +269,8 @@ func NewDockerEngineContainer(id uint32, conf *inventory.Config, asset *inventor conn.PlatformIdentifier = containerid.MondooContainerID(ci.ID) conn.Metadata.Name = containerid.ShortContainerImageID(ci.ID) conn.Metadata.Labels = ci.Labels - conn.Asset().Name = ci.Name + asset.Name = ci.Name + asset.PlatformIds = []string{containerid.MondooContainerID(ci.ID)} return conn, nil } } From 033d3dc55aeb9c297e210c99cb3236c15a5fe407 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Wed, 27 Sep 2023 15:51:17 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20platformID=20for=20con?= =?UTF-8?q?tainer=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When scanning a single image which isn't present in the local docker daemon, the platformID was missing. Fixes #1952 Signed-off-by: Christian Zunker --- providers/os/connection/docker_container.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/providers/os/connection/docker_container.go b/providers/os/connection/docker_container.go index 4008c3859b..4dd85dc06b 100644 --- a/providers/os/connection/docker_container.go +++ b/providers/os/connection/docker_container.go @@ -297,7 +297,10 @@ func NewDockerContainerImageConnection(id uint32, conf *inventory.Config, asset // The requested image isn't locally available, but we can pull it from a remote registry. if len(resolvedAssets) > 0 && resolvedAssets[0].Connections[0].Type == "container-registry" { - return NewContainerRegistryImage(id, conf, resolvedAssets[0]) + asset.Name = resolvedAssets[0].Name + asset.PlatformIds = resolvedAssets[0].PlatformIds + asset.Labels = resolvedAssets[0].Labels + return NewContainerRegistryImage(id, conf, asset) } // could be an image id/name, container id/name or a short reference to an image in docker engine