jfrog / jfrog/jfrog-cli-security
Failure while reading containerd-sourced images
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13
- Forks
- 50
- Avg merge
- 3d 48m
- Merged PRs (30d)
- 26
Description
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.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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the default and containerd Docker exports, then run jf scan on both tar files. Inspect the referenced docker_tar.go and oci_tar.go paths, starting at DockerTarOpener.analyzeTarAsContainer and manifest validation. Done means the containerd tar produces a viable security scan instead of falling back to generic tar indexing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100