Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure while reading containerd-sourced images #2601

Open
inquinity opened this issue Jul 16, 2024 · 1 comment
Open

Failure while reading containerd-sourced images #2601

inquinity opened this issue Jul 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@inquinity
Copy link

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.

  1. Check that "Use containerd for pulling and storing images" option in Docker Desktop is disabled. This is "control" test.

  2. Download the image if needed:
    docker pull mariadb:latest

  3. Save image to tar file:
    docker save mariadb:latest -o mariadb-latest-default.tar

  4. Enable "Use containerd for pulling and storing images" option in Docker Desktop. (Docker will restart)

image
  1. Download the image if needed:
    docker pull mariadb:latest

  2. Save image to tar file:
    docker save mariadb:latest -o mariadb-latest-containerd.tar

  3. Scan the images:
    jf scan mariadb-latest-default.tar
    jf 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

@inquinity inquinity added the bug Something isn't working label Jul 16, 2024
@bmanuel
Copy link

bmanuel commented Nov 18, 2024

This behavior is still present in the CLI. The containerd storage option is now the default in Docker Desktop, so this is only going to become a bigger issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants