Skip to content

Refactor to make it clearer that we return the validated TOC value#1887

Merged
openshift-merge-bot[bot] merged 3 commits intocontainers:mainfrom
mtrmac:toc-clarity
Apr 16, 2024
Merged

Refactor to make it clearer that we return the validated TOC value#1887
openshift-merge-bot[bot] merged 3 commits intocontainers:mainfrom
mtrmac:toc-clarity

Conversation

@mtrmac
Copy link
Copy Markdown
Collaborator

@mtrmac mtrmac commented Apr 13, 2024

Primarily, this ensures that the value in ApplyDiff’s DriverWithDifferOutput.TOCDigest is really exactly the value we used to validate the digest, by only reading it once and passing it around.

That’s to simplify auditing and make the relationship clear, but it should not change behavior.

Incidentally, this also should fix #1886 — but I still think the binary footer code path should be removed entirely.

Cc: @giuseppe

Make it structually clear that the code is all using the same value,
making it less likely for the verifier and other uses to get out of sync.

Also avoids some redundant parsing and error paths.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Apr 13, 2024

(Completely untested, to be transparent.)

mtrmac added 2 commits April 13, 2024 16:57
Make it structually clear that the code is all using the same value,
making it less likely for the verifier and other uses to get out of sync.

Also avoids some redundant parsing and error paths.
The conversion path looks longer, but that's just moving the parsing
from the called function (which is redundant for other callers).

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Manage the value directly to simplify.

This happens to fix the ReadFooterDataFromBlob code path,
which was not setting ChecksumAnntation at all.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Copy link
Copy Markdown
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

I've tested it with some existing images and it works well.

LGTM

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 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

Details 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

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Apr 16, 2024

LGTM

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Apr 16, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Apr 16, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 0c648bf into containers:main Apr 16, 2024
@mtrmac mtrmac deleted the toc-clarity branch April 16, 2024 12:36
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.

zstd:chunked binary footer format is broken

3 participants