Skip to content

fix(image): don't reject remote images whose ArtifactType is just a config media type - #65

Merged
Bit-Doctor merged 1 commit into
djc/main-dd-069from
jmachado/backport-remote-artifact-type
Jul 17, 2026
Merged

fix(image): don't reject remote images whose ArtifactType is just a config media type#65
Bit-Doctor merged 1 commit into
djc/main-dd-069from
jmachado/backport-remote-artifact-type

Conversation

@Bit-Doctor

@Bit-Doctor Bit-Doctor commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Backports the fix from upstream aquasecurity/trivy (present as of v0.72.0, commit 3ea80c0) using the IsConfig() helper already available in this fork's go-containerregistry version -- no dependency bump required.

  • Single-architecture image manifests (i.e. a tag resolving directly to an image manifest rather than a multi-arch manifest list/index) have a Config field. When the manifest has no explicit artifactType, go-containerregistry falls back to setting Descriptor.ArtifactType to the config's media type (e.g. application/vnd.docker.container.image.v1+json).

  • tryRemote's check for non-image OCI artifacts (Helm charts, WASM modules, etc.) didn't account for this, so plain single-arch images pulled via the remote image source fallback were incorrectly rejected with:

    remote error: unsupported artifact type "application/vnd.docker.container.image.v1+json" for image "..."
    

    This was hit by a datadog-security-cli customer scanning an ECR image directly (no local Docker/containerd/podman available), and reproduces for any single-arch image pulled via the remote fallback.

Test plan

  • Added a regression test case (regular image with explicit docker config media type) to Test_tryRemote
  • Verified against go-containerregistry v0.21.7 (the version datadog-security-cli actually resolves via MVS, since it requires it directly) that the bug reproduces without the fix and is resolved with it
  • Confirmed the existing helm chart config media type rejection test still passes (no regression on the original intent of the check)

Links

Made with Cursor

…onfig media type

go-containerregistry sets Descriptor.ArtifactType to the manifest's config
media type whenever the manifest itself has no explicit `artifactType` field.
This is the case for essentially all plain, single-architecture image
manifests fetched directly (as opposed to a multi-arch manifest list/index,
which has no config field and so leaves ArtifactType empty).

The check added to reject non-image OCI artifacts (Helm charts, WASM
modules, etc.) in the remote image source didn't account for this, causing
single-arch images pulled via the remote fallback to fail with:

    remote error: unsupported artifact type "application/vnd.docker.container.image.v1+json" for image "..."

Backported from upstream aquasecurity/trivy (fixed as of v0.72.0, alongside
a go-containerregistry bump that isn't needed here since IsConfig() is
already available in the go-containerregistry version this fork depends on).

Co-authored-by: Cursor <cursoragent@cursor.com>
@Bit-Doctor
Bit-Doctor merged commit 0936bc6 into djc/main-dd-069 Jul 17, 2026
6 of 14 checks passed
@Bit-Doctor
Bit-Doctor deleted the jmachado/backport-remote-artifact-type branch July 17, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants