Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.11] provenance: fix possible empty digest access #3899

Merged
merged 1 commit into from
May 25, 2023

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented May 25, 2023

If the digest for an ImageSource is the empty string, then calling
`Digest.Algorithm` will panic at runtime.

This scenario *can* happen if `ResolveImageConfig` returns an empty
digest, but correctly returns a config object. This doesn't occur in
buildkit directly, however, buildkit-in-moby implements a custom worker
which also performs image lookups on local images, in which case the
digest for the index may not be available (though this may be possible
with the containerd image store?).

Therefore, we shouldn't assume that the digest is always available in
buildkit, and should instead check that is valid before inserting it
into the digest set (which is already an optional map).

Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit e398498)
Signed-off-by: Justin Chadwell <me@jedevc.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@jedevc jedevc merged commit 5ab7e4f into moby:v0.11 May 25, 2023
43 checks passed
@jedevc jedevc deleted the v0.11-provenance-possible-nil-digest branch May 25, 2023 10:34
@crazy-max crazy-max added this to the v0.11.7 milestone Jul 20, 2023
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.

None yet

3 participants