pluggable-scanner-spec icon indicating copy to clipboard operation
pluggable-scanner-spec copied to clipboard

Needed to use artifact media type as consumes_mime_types of capabilities

Open heww opened this issue 4 years ago • 0 comments

We are working on the OCI support in Harbor 2.0 and we will improve the user experience of artifact scanning in this release.

In Harbor 2.0, the vulnerabilities info of the artifact will display in the portal only when the artifact can be scanned by the scanner, and only scannable artifact can click the Scan button in the portal.

Harbor will use the consumes_mime_types of capabilities from scanner metadata to decide whether the artifact supported by the scanner.

Currently, the consumes_mime_types returns by the scanner always be application/vnd.oci.image.manifest.v1+json and application/vnd.docker.distribution.manifest.v2+json. These mime tyeps are the manifest media type of the artifact, and they mean that the scanner support docker image and oci image.

According to the OCI spec the manifest media type of the artifact always application/vnd.oci.image.manifest.v1+json and application/vnd.oci.image.index.v1+json. application/vnd.docker.distribution.manifest.v2+json and application/vnd.docker.distribution.manifest.list.v2+json are also supported for the backwards and forwards compatible.

The result is that the scanner supports to scan all OCI artifacts includes helm chart, regular file and others. This is not true for the scanner. Now in Harbor 2.0 we use a black list to deal this problem, when the type of the artifact in the list, we assert that the artifact is not scannable. It works but what can we do when the scanner support to scan helm chart?

In Harbor 2.0 the manifest media type for helm charts, docker image are application/vnd.oci.image.manifest.v1+json and application/vnd.docker.distribution.manifest.v2+json, but their media type are different. The media type of the helm chart is application/vnd.cncf.helm.config.v1+json and the media type of the docker image is application/vnd.docker.container.image.v1+json. So I suggest to use the artifact media type as consumes_mime_types of capabilities for the scanner.

heww avatar Mar 10 '20 03:03 heww