Skip to content

fix(image): reject an empty until filter value - #5304

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
ogulcanaydogan:fix/image-prune-empty-until-filter
Oct 30, 2026
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
ogulcanaydogan:fix/image-prune-empty-until-filter

Conversation

@ogulcanaydogan

Copy link
Copy Markdown
Contributor

Fixes #5303

ParseFilters checked the length of the filter name (tempFilterToken[0], which is "until") instead of the value, so until= was accepted and Filters.Until stayed empty. image prune only adds the until filter when it is set, so nerdctl image prune -a --filter until= dropped the filter and removed every unused image.

This checks the value and returns errNoUntilTimestamp, which also makes the check for more than one until filter work when the first one is empty.

TestParseFiltersUntil covers a timestamp, an empty value, an empty value followed by a timestamp and two timestamps. The two empty value cases fail without the change.

ParseFilters checked the length of the filter name instead of the value
for "until", so the check could never fail. "until=" was accepted and left
Filters.Until empty, and image prune only adds the until filter when it is
set. "nerdctl image prune -a --filter until=" therefore dropped the filter
and removed every unused image.

Check the value and return errNoUntilTimestamp, which also makes the
check for more than one until filter work when the first one is empty.

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@gmail.com>
@AkihiroSuda AkihiroSuda added this to the v2.4.2 milestone Oct 30, 2026

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
AkihiroSuda merged commit 68dde19 into containerd:main Oct 30, 2026
27 of 35 checks passed
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.

image prune: --filter until= with an empty value is ignored and prunes every unused image

2 participants