-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Digest references to images don’t enforce that the digest matches #17682
Comments
One possibility would be for That would (per
I’m not at all sure it is worth it at this point (and it’s somewhat possible that starting to enforce digest matches could break some existing code path). |
Thanks for the nice summary, @mtrmac. A fix that I have in mind would be to jump directly to the digest-matching-lookup when the input is digested. That may even speed up digested lookups. BUT it looks like the digested name has been forcefully added to images.json, so it may be a reasonable assumption that the offender knew what they where doing. My personal take is that changing such internal and state is entirely unsupported and should be discouraged by all means. Certainly, some changes to some code would help to detect some cases where internal data and state has been "corrupted" but I still see it as a corruption forced by the user. So osbuild/osbuild#1252 is worrying me. |
Yes, that would fix this case where
(BTW containers/common#1352 .)
I 100% agree, this is completely unsupported. I wanted to bring this up in case there were some costless way to avoid that — and also to double-check that this does not seem to allow bypassing any digest enforcement where users might rely on it happening. |
A friendly reminder that this issue had no activity for 30 days. |
It seems that we don’t have any trivially-cheap ideas to protect ourselves in this case of invalid writes, so let’s have the users doing those invalid writes deal with it as best they can… |
As discovered in osbuild/osbuild#1252 , if, somehow, a repo
@sha256:
digest is written in theName
field of a c/storage image (but the digest does not match any actual manifest of the image we have seen), Podman uses of that name will succeed.Compare:
vs.
The cause seems to be that once https://github.com/containers/common/blob/18c4568e8ee051fd8ded1d9d47cfa0453b1d6a0c/libimage/runtime.go#L324 , finds a name match, it captures the image’s ID, and from that point on, all of
libimage
’s references to that image use the image ID, not the user’s input; so, c/image never sees a digested reference and never triggers the “ensure the manifest matches the digest” enforcement.I’m not sure what, if anything, to do about this. In ordinary operation, repo
@sha256:
digest values end up inImage.Names
only by a pull that does validate a digest, and we certainly don’t make any promises if the c/storage image store is manually modified.Also, once an image is identified, referring to it using an immutable ID is clearly valuable; I don’t want to suggest at all that that should change.
Still, I think it’s at least worth discussing to see if we should do something else.
One possible option would be for
lookupImageInLocalStorage
to do something to explicitly trigger the digest enforcement code, maybeReference().NewImage().Manifest()
. But that would be an extra cost for little benefit for most users.@vrothberg WDYT?
The text was updated successfully, but these errors were encountered: