Skip to content

fix(image-spec): Several fixes in image-spec#322

Draft
craciunoiuc wants to merge 2 commits into
prod-stagingfrom
craciunoiuc/several-fixes-to-imagespec
Draft

fix(image-spec): Several fixes in image-spec#322
craciunoiuc wants to merge 2 commits into
prod-stagingfrom
craciunoiuc/several-fixes-to-imagespec

Conversation

@craciunoiuc

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes two correctness issues in the image-spec package's tarball export path. First, it avoids a potential nil pointer dereference in SaveContent when an image has no Image config. Second, and more importantly, it fixes a corrupt-tarball bug: SaveContent always returns an image index descriptor, and handing that index directly to archive.Export (with no platform option) caused the exporter to write the index blob into index.json as a manifest entry with the application/vnd.oci.image.index.v1+json media type, which registries reject. The fix resolves the index to its child manifest descriptors and exports those. A new test verifies the resulting archive's index.json references only manifests, and go.work.sum is updated with new dependency checksums.

Changes:

  • Guard image.Image with a nil check before dereferencing Platform in ctrd_save.go.
  • Add manifestDescriptors in backend_archive.go to expand an index descriptor into its child manifests and export each via archive.WithManifest.
  • Add TestSaveTarballIndexReferencesManifests validating archive index.json contents, plus go.work.sum checksum updates.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
image-spec/ctrd_save.go Adds a nil check before dereferencing image.Image.Platform, preventing a panic.
image-spec/backend_archive.go Resolves the index descriptor to child manifest descriptors before export to avoid emitting an index-typed entry in index.json.
image-spec/backend_test.go Adds a test asserting exported index.json references only manifest-typed, well-formed manifest blobs.
go.work.sum Auto-generated dependency checksum additions/removals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread image-spec/backend_archive.go Outdated
Comment thread image-spec/backend_test.go Outdated
Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
@craciunoiuc craciunoiuc force-pushed the craciunoiuc/several-fixes-to-imagespec branch from a7f888c to 6719e20 Compare July 3, 2026 11:15
@craciunoiuc craciunoiuc requested review from jedevc and robertgzr July 3, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants