Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

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

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

openshift-merge-bot[bot] merged 3 commits into
containers:mainfrom
mtrmac:toc-clarity

Conversation

@mtrmac

@mtrmac mtrmac commented Apr 13, 2024

Copy link
Copy Markdown
Collaborator

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č <[email protected]>
@mtrmac

mtrmac commented Apr 13, 2024

Copy link
Copy Markdown
Collaborator Author

(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č <[email protected]>
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č <[email protected]>

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Member

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

openshift-ci Bot commented Apr 15, 2024

Copy link
Copy Markdown
Contributor

[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

rhatdan commented Apr 16, 2024

Copy link
Copy Markdown
Member

LGTM

@rhatdan

rhatdan commented Apr 16, 2024

Copy link
Copy Markdown
Member

/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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zstd:chunked binary footer format is broken

3 participants