Skip to content

Commit 7fe9137

Browse files
jeckersbcgwalters
authored andcommitted
oci: ensure_config: get raw config via get_descriptor
`fetch_config_raw` may reorder map keys in the config json, which means the sha256sum of the config does not match what is expected from the image manifest. Resolves: #91 Signed-off-by: John Eckersberg <[email protected]>
1 parent b9f6e06 commit 7fe9137

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/oci/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,17 @@ impl<'repo> ImageOp<'repo> {
157157
//
158158
self.progress
159159
.println(format!("Fetching config {}", hex::encode(config_sha256)))?;
160-
let raw_config = self.proxy.fetch_config_raw(&self.img).await?;
161-
let config = ImageConfiguration::from_reader(raw_config.as_slice())?;
160+
161+
let (mut config, driver) = self.proxy.get_descriptor(&self.img, descriptor).await?;
162+
let config = async move {
163+
let mut s = Vec::new();
164+
config.read_to_end(&mut s).await?;
165+
anyhow::Ok(s)
166+
};
167+
let (config, driver) = tokio::join!(config, driver);
168+
let _: () = driver?;
169+
let raw_config = config?;
170+
let config = ImageConfiguration::from_reader(&raw_config[..])?;
162171

163172
let mut config_maps = DigestMap::new();
164173
for (mld, cld) in zip(manifest_layers, config.rootfs().diff_ids()) {

0 commit comments

Comments
 (0)