Skip to content

fix: only infer platform from OCI image configs - #2177

Merged
TerryHowe merged 3 commits into
oras-project:mainfrom
TanvirTian:fix/index-platform-detection
Sep 21, 2026
Merged

TerryHowe merged 3 commits into
oras-project:mainfrom
TanvirTian:fix/index-platform-detection

Conversation

@TanvirTian

@TanvirTian TanvirTian commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
oras manifest index create currently infers a platform from the config blob of every OCI image manifest, regardless of the config media type.

This means a non-image artifact with a JSON config containing os and architecture fields can incorrectly receive a platform field when added to an image index.

This PR limits platform inference to manifests whose config media type is application/vnd.oci.image.config.v1+json, which is the OCI image config media type.
A regression test was added to verify that platform information is not inferred from a non-image config containing os and architecture fields.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2178

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Comment thread cmd/oras/root/manifest/index/create.go Resolved

@TerryHowe TerryHowe left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lint issue fix and I think we are g2g

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.72%. Comparing base (87495d5) to head (de4d135).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2177      +/-   ##
==========================================
- Coverage   87.81%   87.72%   -0.10%     
==========================================
  Files         139      139              
  Lines        5689     5694       +5     
==========================================
- Hits         4996     4995       -1     
- Misses        413      417       +4     
- Partials      280      282       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: TanvirTian <[email protected]>
@TanvirTian

Copy link
Copy Markdown
Contributor Author

Lint issue fix and I think we are g2g
Fixed the lint issue and pushed the changes. All checks are passing now. Thanks :)

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe
TerryHowe merged commit 8016ba3 into oras-project:main Sep 21, 2026
9 checks passed
@TerryHowe

Copy link
Copy Markdown
Member

Thanks!

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.

Incorrect platform inference for non-image configs

2 participants