storage icon indicating copy to clipboard operation
storage copied to clipboard

chunked: do not use a temporary file

Open giuseppe opened this issue 1 year ago • 7 comments

and use directly the stream to create the temporary zstd:chunked file.

giuseppe avatar Jul 24 '24 09:07 giuseppe

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

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-ci[bot] avatar Jul 24 '24 09:07 openshift-ci[bot]

LGTM and I'd like to get this in before starting the vendor dance. @nalind @mtrmac PTAL

TomSweeneyRedHat avatar Jul 24 '24 14:07 TomSweeneyRedHat

I’m really more worried about the decompression than the chunked conversion. That’s a lot of bit manipulation, potentially in an unsafe language “for performance”, with a fair history of vulnerabilities.

Though now that we're forking a separate process we could isolate those quite aggressively.

cgwalters avatar Jul 24 '24 16:07 cgwalters

Which forking does that refer to?

mtrmac avatar Jul 24 '24 16:07 mtrmac

Which forking does that refer to?

https://github.com/containers/storage/pull/1964

cgwalters avatar Jul 24 '24 16:07 cgwalters

… and for ordinary image pulls, we currently also stream the input through decompression, only validating the digest concurrently; we don’t validate the digest before starting to decompress. So, in that sense, we are already accepting a larger part of the risk.

Right there's that and also ultimately we still need to be safe against untrusted/malicious zstd:chunked inputs even if the checksum matches.

So I'm going to proactively reopen this PR since I think it makes sense.

cgwalters avatar Jul 25 '24 14:07 cgwalters

If this is merged on or before August 12, 2024, please cherry-pick this to the release-1.55 branch

TomSweeneyRedHat avatar Jul 25 '24 21:07 TomSweeneyRedHat