Repository navigation
Add 'sha256:' prefix to imageID checksum for GetLocalImage - #597
Merged
Merged
Conversation
pohanhuang
requested changes
Oct 12, 2026
Contributor
|
@adamacosta can you fix the linter issue? |
pohanhuang
approved these changes
Oct 12, 2026
Contributor
|
Thanks @adamacosta |
Addresses neuvector/neuvector#2508. The containerd '/images/get' API does not accept bare checksums without a prepended algorithm identifier for the image ID. The moby client's ImageSave() call fails for Docker >=29.0, which now uses the containerd image store (see https://docs.docker.com/engine/storage/containerd/) instead of the classic storage drivers. This hard-codes 'sha256:' as the prefix, which is *not* future proof. See https://github.com/opencontainers/image-spec/blob/main/descriptor.md\#registered-algorithms, which states compliant implementations of OCI SHOULD use SHA-256, but there are other registered algorithms we may see used in the future.
Contributor
|
Thanks @adamacosta for the contribution! |
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix neuvector/neuvector#2508
The containerd
/images/getAPI does not accept bare checksums without a prepended algorithm identifier for the image ID. The moby client'sImageSave()call fails for Docker >=29.0, which now uses the containerd image store (see https://docs.docker.com/engine/storage/containerd/) instead of the classic storage drivers.This duplicates #587 and @clbiggs deserves credit, but a change was requested three weeks ago without a response, so I'm duplicating and implementing the change request.
Test
Build this locally:
Re-tag some image to force local scan:
Scan it:
This should work and produce a result. For example:
Before it would fail and fall back to attempting a pull of the remote image (re-tagging to create a repo name that doesn't exist remotely prevents that from working). If you turned on debug logging, you'd have seen:
Indicating the issue that the containerd socket doesn't accept 64-byte hexadecimal strings without a prefix.
Additional Information
Tradeoff
This hard-codes 'sha256:' as the prefix, which is not future proof. See https://github.com/opencontainers/image-spec/blob/main/descriptor.md\#registered-algorithms, which states compliant implementations of OCI SHOULD use SHA-256, but there are other registered algorithms we may see used in the future.
Potential improvement