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

chunked: validate converted images #1794

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Jan 8, 2024

validate that the retrieved data for converted images matches the expected digest.

The related change in c/image:

diff --git a/storage/storage_dest.go b/storage/storage_dest.go
index 0cd4392a..56f16461 100644
--- a/storage/storage_dest.go
+++ b/storage/storage_dest.go
@@ -279,7 +279,7 @@ func (s *storageImageDestination) PutBlobPartial(ctx context.Context, chunkAcces
                blobInfo:      srcInfo,
        }
 
-       differ, err := chunked.GetDiffer(ctx, s.imageRef.transport.store, srcInfo.Size, srcInfo.Annotations, &fetcher)
+       differ, err := chunked.GetDiffer(ctx, s.imageRef.transport.store, &srcInfo.Digest, srcInfo.Size, srcInfo.Annotations, &fetcher)
        if err != nil {
                return private.UploadedBlob{}, err
        }

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

I think this works; but really it seems to me that the convert_images boolean (… if it continues to exist in the production version of composefs; I don’t know if that’s the plan) should be handled around the ordinary Store.PutLayer. If nothing else, then it would work with registries which don’t support range requests.

cmd/containers-storage/diff.go Outdated Show resolved Hide resolved
pkg/chunked/storage_linux.go Outdated Show resolved Hide resolved
pkg/chunked/storage_linux.go Outdated Show resolved Hide resolved
pkg/chunked/storage_linux.go Outdated Show resolved Hide resolved
pkg/chunked/storage_linux.go Outdated Show resolved Hide resolved
validate that the retrieved data for converted images matches the
expected digest.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe giuseppe force-pushed the zstd-chunked-validate-converted-images branch from ca10e69 to fa794cb Compare January 8, 2024 21:01
@giuseppe
Copy link
Member Author

giuseppe commented Jan 8, 2024

@mtrmac thanks for the review.

I've addressed your comments and pushed a new version

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks!

Copy link
Contributor

openshift-ci bot commented Jan 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, mtrmac

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 5279ccc into containers:main Jan 8, 2024
6 of 18 checks passed
@giuseppe
Copy link
Member Author

giuseppe commented Jan 9, 2024

thanks! The related change in c/image:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants