Skip to content

fix: avoid content storage pollution by limiting the fallback on ref resolution#13017

Merged
mxpv merged 1 commit into
containerd:mainfrom
jzhn:main
Mar 25, 2026
Merged

fix: avoid content storage pollution by limiting the fallback on ref resolution#13017
mxpv merged 1 commit into
containerd:mainfrom
jzhn:main

Conversation

@jzhn

@jzhn jzhn commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

/kind bug

What

Fixes: #13007 by limiting the fallback to /blobs endpoint on resolve.Resolve. It could permanently corrupt an image in local content store due to incorrect content-type returned.

Alternatives considered

Remove the /blobs/ fallback entirely

The /blobs/ fallback was introduced to support non-standard or legacy registries that serve manifest content only through the blob endpoint. Removing it entirely would be the cleanest fix, but could silently break users relying on this behavior without any clear migration path. Since there is no registry conformance test enforcing the /manifests/ endpoint, some private/custom registries may depend on it. Rejected to avoid a potentially breaking change.

Validate the Content-Type returned by /blobs/ against known manifest media types

After falling back to /blobs/, check whether the returned Content-Type is a recognized manifest or index media type (using images.IsManifestType / images.IsIndexType). If not, skip the result and continue.

This approach catches the symptom (wrong media type) rather than the cause (wrong error triggering the fallback). It also makes a hidden assumption that Resolve() is only ever used to resolve manifests — but Resolve() is a general-purpose descriptor resolver and /blobs/ is a legitimate path for non-manifest content in some workflows. Rejected as too narrow and fragile.

@dmcgowan dmcgowan moved this from Needs Triage to Review In Progress in Pull Request Review Mar 13, 2026
@dmcgowan dmcgowan added this to the 2.3 milestone Mar 13, 2026
@dmcgowan dmcgowan added size/S and removed size/L labels Mar 13, 2026
@mxpv
mxpv added this pull request to the merge queue Mar 25, 2026
Merged via the queue into containerd:main with commit 1abba0c Mar 25, 2026
95 of 96 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Mar 25, 2026
@thaJeztah

Copy link
Copy Markdown
Member

/cherry-pick release/2.2

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@thaJeztah: new pull request created: #13620

Details

In response to this:

/cherry-pick release/2.2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@thaJeztah

Copy link
Copy Markdown
Member

/cherry-pick release/2.1

@thaJeztah

Copy link
Copy Markdown
Member

/cherry-pick release/2.0

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@thaJeztah: new pull request created: #13621

Details

In response to this:

/cherry-pick release/2.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@thaJeztah: new pull request created: #13622

Details

In response to this:

/cherry-pick release/2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@thaJeztah thaJeztah added cherry-picked/2.0.x PR commits are cherry picked into the release/2.0 branch cherry-picked/2.1.x PR commits are cherry picked into the release/2.1 branch cherry-picked/2.2.x PR commits are cherry-picked into release/2.2 branch labels Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/distribution Image Distribution cherry-picked/2.0.x PR commits are cherry picked into the release/2.0 branch cherry-picked/2.1.x PR commits are cherry picked into the release/2.1 branch cherry-picked/2.2.x PR commits are cherry-picked into release/2.2 branch kind/bug size/S

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Resolve fallback from /manifests to /blobs permanently poisons image cache with wrong media type

6 participants