Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Return error if blob download is incomplete by validating hash digest. #1833

Merged
merged 8 commits into from
Feb 21, 2024

Conversation

kchilleri
Copy link
Contributor

@kchilleri kchilleri commented Feb 6, 2024

Closes #1758

@kchilleri kchilleri requested review from reidpr and removed request for reidpr February 6, 2024 19:39
Copy link
Collaborator

@reidpr reidpr left a comment

Choose a reason for hiding this comment

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

Great work; you've solved the essence of the issue.

See in-line for some other comments.

Also — how might we test this? It's a fairly rare case for the error to come up naturally, so the new code path won't be exercised much unless we add test(s). I have some ideas that we can talk about, but first I'd like you to noodle on it some.

lib/registry.py Outdated Show resolved Hide resolved
lib/registry.py Outdated Show resolved Hide resolved
lib/registry.py Outdated Show resolved Hide resolved
@kchilleri kchilleri requested a review from reidpr February 20, 2024 18:41
Copy link
Collaborator

@reidpr reidpr left a comment

Choose a reason for hiding this comment

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

Great work. The logic seems quite solid to me. I have some style recommendations in-line.

One oversight, unless I’ve missed something: request() only checks the digest if the response is going to a file, i.e. out != None. I think this is fine, but the arguments need to be checked. As written, if out == None and expdigest != None, the latter will be silently ignored. It should instead fail noisily. assert would be fine I think.

lib/registry.py Outdated Show resolved Hide resolved
lib/registry.py Outdated Show resolved Hide resolved
lib/registry.py Outdated Show resolved Hide resolved
lib/registry.py Outdated Show resolved Hide resolved
lib/registry.py Outdated Show resolved Hide resolved
@kchilleri kchilleri requested a review from reidpr February 21, 2024 00:04
Copy link
Collaborator

@reidpr reidpr left a comment

Choose a reason for hiding this comment

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

Nice. I didn’t see an assert so I added one.

@reidpr reidpr merged commit d40b0ff into master Feb 21, 2024
6 checks passed
@reidpr reidpr deleted the incomplete-blob-download_1758 branch February 21, 2024 16:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ch-image doesn’t notice incomplete blob downloads
2 participants