Skip to content

fix: resolve platform detection in archives missing index metadata#750

Draft
bgardiner wants to merge 1 commit intomainfrom
fix/oci-multi-manifest-platform-detection
Draft

fix: resolve platform detection in archives missing index metadata#750
bgardiner wants to merge 1 commit intomainfrom
fix/oci-multi-manifest-platform-detection

Conversation

@bgardiner
Copy link
Copy Markdown
Contributor

@bgardiner bgardiner commented Feb 5, 2026

Modern Docker versions often produce OCI archives where individual manifests in the index.json lack platform information. This caused the OCI extractor to fail when multiple manifests were present because it couldn't disambiguate them. This fix allows the extractor to resolve platform information from image configuration blobs as a fallback.

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Modern Docker versions often produce OCI archives where individual manifests in the index.json lack platform information. This caused the OCI extractor to fail when multiple manifests were present because it couldn't disambiguate them. This fix allows the extractor to resolve platform information from image configuration blobs as a fallback.

Where should the reviewer start?

N/A

How should this be manually tested?

Create a tar archive containing multiple manifests from a modern docker daemon with containerd disabled as the image store. Running snyk container test on such an image fails with existing public versions of the CLI. Running snyk container test with this commit succeeds.

Any background context you want to provide?

https://snyk.slack.com/archives/C85H8Q12Q/p1769554752582849

What are the relevant tickets?

…dex metadata

Modern Docker versions often produce OCI archives where individual manifests in the index.json lack platform information. This caused the OCI extractor to fail when multiple manifests were present because it couldn't disambiguate them. This fix allows the extractor to resolve platform information from image configuration blobs as a fallback.
@bgardiner bgardiner requested a review from adrobuta February 5, 2026 21:17
return {
os: config.os,
architecture: config.architecture,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we return the variant too here?

};
if (target.platform) {
return {
os: target.platform.os,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a reason here why we switched from optional chaining to direct access?

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