Skip to content

Incorrect platform inference for non-image configs #2178

Closed

Description

@TanvirTian

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

  1. Create a config containing os and architecture:
{"os":"linux","architecture":"amd64"}
  1. 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
  1. Create an index from the artifact:
oras manifest index create \
  /tmp/oras-weird-platform:index \
  fake \
  --oci-layout
  1. Inspect the resulting index:
oras manifest fetch \
  --oci-layout /tmp/oras-weird-platform:index

The 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

  1. added
    bug
    triage
    on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions