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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Expect UncompressedDigest to be set for partial pulls, enforce DiffID match #2613

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Oct 30, 2024

mtrmac added a commit to mtrmac/libpod that referenced this pull request Oct 30, 2024
mtrmac added a commit to mtrmac/libpod that referenced this pull request Oct 30, 2024
mtrmac added a commit to mtrmac/libpod that referenced this pull request Oct 30, 2024
// FIXME: Always enforce this for all layers??!
d, err := s.untrustedLayerDiffID(index)
if err != nil {
return nil, err
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All of this completely breaks for non-OCI images: determining DiffID for manifest type %q is not yet supported

This needs to be implemented for v2s2, and we need a reasonable fallback for v2s1.

mtrmac added a commit to mtrmac/libpod that referenced this pull request Nov 18, 2024
mtrmac added a commit to mtrmac/libpod that referenced this pull request Nov 18, 2024
mtrmac added a commit to mtrmac/libpod that referenced this pull request Nov 18, 2024
@mtrmac mtrmac force-pushed the wip-authentic branch 3 times, most recently from e46c8d0 to eb0db7b Compare November 22, 2024 20:15
mtrmac added a commit to mtrmac/libpod that referenced this pull request Nov 25, 2024
> go mod edit -replace github.com/containers/image/v5=github.com/mtrmac/image/v5@wip-authentic

Signed-off-by: Miloslav Trmač <[email protected]>
If the value is set to a zero-byte value, use it, instead
of trying to look for a value again / elsewhere.

This should not make a difference in practice, a zero-length
manifest is invalid anyway; so it's just a conceptual cleanup
/ a microoptimization.

Signed-off-by: Miloslav Trmač <[email protected]>
Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
Other parts of the code already assume that the value
is always valid, so don't treat an empty value specially.

Signed-off-by: Miloslav Trmač <[email protected]>
Always check for nil, not for len(0).

Ensure that PutManifest always sets it to non-nil,
so that valid call sequences (with an invalid empty manifest)
don't show up as hard-to-explain invariant violations.

Signed-off-by: Miloslav Trmač <[email protected]>
We will add one more user.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
For now this is not really relevant, but we will want to enforce
the correctness of those values in the future.

Signed-off-by: Miloslav Trmač <[email protected]>
For now, this only adds the API, nothing actually benefits from
it yet.

Signed-off-by: Miloslav Trmač <[email protected]>
Record DiffIDs early, so that we can commit partially-pulled
layers immediately after staging them, and we don't have to wait
for PutManifest.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac mtrmac force-pushed the wip-authentic branch 3 times, most recently from 95cdcf3 to 57b0637 Compare November 26, 2024 20:38
mtrmac added a commit to mtrmac/libpod that referenced this pull request Nov 26, 2024
> go mod edit -replace github.com/containers/image/v5=github.com/mtrmac/image/v5@wip-authentic

Signed-off-by: Miloslav Trmač <[email protected]>
untrustedLayerDiffID currently specializes the "not available yet"
case; also specialize the "image does not provide this at all"
case, which we will need to handle.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
We will want c/storage to do that in order to avoid the traditional/partial "view"
ambiguity.

Signed-off-by: Miloslav Trmač <[email protected]>
We will use the trustedLayerIdentityData for other purposes in the caller as well.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
commitLayer already contains detailed logic for computing
the final layer ID (chain ID), so having the detailed logic
for the single layer component in a separate function is not
any clearer.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
wrong place, wrong logic(?)

Signed-off-by: Miloslav Trmač <[email protected]>
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.

1 participant