Repository navigation
Description
What happened in your environment?
oras manifest index create incorrectly infers a platform from a non-image config.
In my local environment, I created an OCI artifact with a custom config media type containing "os" and "architecture" fields. When creating an index from the artifact, ORAS added a platform field to the descriptor based on those fields, even though the config was not an OCI image config.
For example, the config contained:
{"os":"linux","architecture":"amd64"}with the config media type:
application/vnd.example.fake.config+json
The resulting index descriptor was incorrectly assigned:
"platform": {
"os": "linux",
"architecture": "amd64"
}What did you expect to happen?
ORAS should not infer a platform from a config unless the config uses the OCI image config media type.
For a non-image config, the resulting index descriptor should have no platform field, even if the config JSON contains os and architecture fields.
How can we reproduce it?
Steps to reproduce
- Create a config containing os and architecture:
{"os":"linux","architecture":"amd64"}- Push an OCI artifact using a non-image config media type:
oras push \
--oci-layout /tmp/oras-weird-platform:fake \
--artifact-type application/vnd.example.fake \
--config fake-config.json:application/vnd.example.fake.config+json \
oras-amd64.txt:application/octet-stream- Create an index from the artifact:
oras manifest index create \
/tmp/oras-weird-platform:index \
fake \
--oci-layout- Inspect the resulting index:
oras manifest fetch \
--oci-layout /tmp/oras-weird-platform:indexThe descriptor for the artifact incorrectly contains:
"platform": {
"os": "linux",
"architecture": "amd64"
}The config media type is application/vnd.example.fake.config+json, not application/vnd.oci.image.config.v1+json
What is the version of your ORAS CLI?
Version: 1.3.4
Go version: go1.26.7
OS/Arch: linux/amd64
What is your OS environment?
CachyOS Linux (linux/amd64)
Are you willing to submit PRs to fix it?
- Yes, I am willing to fix it.
Activity