Failure while reading containerd-sourced images
Describe the bug
Docker desktop has two options for pulling and storing images internally: the default container and containerd.
jf cli cannot scan images or tar files created using containerd.
Current behavior
JFrog Xray version is: 3.86.11
command: jf scan mariadb-latest-containerd.tar
[jfxia] [WARN ] [] [docker_tar:74 ] [UnnamedContext ] Failed to index tar file as container image, continue to generic tar indexer. Error: failed to analyze OCI tar archive --- at /go/src/jfrog.com/xray/backend/indexer/indexer_core/docker_tar.go:144 (DockerTarOpener.analyzeTarAsContainer) --- Caused by: failed to parse and validate manifests list: index.json --- at /go/src/jfrog.com/xray/backend/indexer/indexer_core/oci_tar.go:53 (DockerTarOpener.handleIndexFile) --- Caused by: manifest unexpected media type: application/vnd.oci.image.index.v1+json --- at /go/src/jfrog.com/xray/backend/indexer/indexer_core/oci_tar.go:95 (DockerTarOpener.parseAndValidateManifestsList) ---
Reproduction steps
I used mariadb:lateset as an example, since it is easily available. It is NOT necessary to export files to tar, but doing so makes it easier to demonstrate the error.
-
Check that "Use containerd for pulling and storing images" option in Docker Desktop is disabled. This is "control" test.
-
Download the image if needed:
docker pull mariadb:latest -
Save image to tar file:
docker save mariadb:latest -o mariadb-latest-default.tar -
Enable "Use containerd for pulling and storing images" option in Docker Desktop. (Docker will restart)
-
Download the image if needed:
docker pull mariadb:latest -
Save image to tar file:
docker save mariadb:latest -o mariadb-latest-containerd.tar -
Scan the images:
jf scan mariadb-latest-default.tarjf scan mariadb-latest-containerd.tar
Expected behavior
jf scan mariadb-latest-default.tar
Will produce a viable security scan.
jf scan mariadb-latest-containerd.tar
Will fail to scan with the following error:
Failed to index tar file as container image, continue to generic tar indexer. Error: failed to analyze OCI tar archive --- at /go/src/jfrog.com/xray/backend/indexer/indexer_core/docker_tar.go:144 (DockerTarOpener.analyzeTarAsContainer) --- Caused by: failed to parse and validate manifests list: index.json --- at /go/src/jfrog.com/xray/backend/indexer/indexer_core/oci_tar.go:53 (DockerTarOpener.handleIndexFile) --- Caused by: manifest unexpected media type: application/vnd.oci.image.index.v1+json --- at /go/src/jfrog.com/xray/backend/indexer/indexer_core/oci_tar.go:95 (DockerTarOpener.parseAndValidateManifestsList) ---
jf will continue despite the failure and fail to find any vulnerabilities
Vulnerable Components ┌───────────────────────────────────────────┐ │ ✨ No vulnerable components were found ✨ │ └───────────────────────────────────────────┘
JFrog CLI version
jf version 2.59.1
Operating system type and version
Mac OS 14.5, Docker Desktop 4.3.1.0
JFrog Artifactory version
No response
JFrog Xray version
JFrog Xray version is: 3.86.11