Skip to content

Commit 3124580

Browse files
committed
Document OCI unpack validation checks.
Add a short comment explaining which malformed config conditions we reject before calling umoci. Made-with: Cursor
1 parent 756540b commit 3124580

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/images/oci.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ func (c *ociClient) unpackLayers(ctx context.Context, layoutTag, targetDir strin
367367
return nil
368368
}
369369

370+
// validateConfigFileForUnpack rejects malformed image configs before calling
371+
// umoci. In particular, we verify that the config blob resolves to a real OCI
372+
// image config, that it declares a layered rootfs, and that rootfs.diff_ids has
373+
// one entry per manifest layer so umoci won't index past the end of the slice.
370374
func validateConfigFileForUnpack(layoutTag string, manifest *gcr.Manifest, configFile *gcr.ConfigFile) error {
371375
if convertToOCIMediaType(string(manifest.Config.MediaType)) != v1.MediaTypeImageConfig {
372376
return fmt.Errorf(

0 commit comments

Comments
 (0)