Skip to content

Fetch OCI image config to reliably determine artifact creation dates instead of relying on time.Now() fallback #6490

@krrish175-byte

Description

@krrish175-byte

Describe the issue

Currently, when the OCI provider fetches artifact versions (GetArtifactVersions), it relies on the org.opencontainers.image.created annotation in the image manifest to determine the artifact's creation date.

However, many container images are not built with this specific annotation. When it is missing, Minder falls back to assigning time.Now() as the creation date (explicitly marked as a // FIXME: This is a hack in internal/providers/oci/oci.go).

Impact:
If a container image is missing the creation annotation, Minder reports it as being created at the exact moment the query was executed. This creates unreliable data and breaks age-based artifact filtering logic, lifecycle policies, and analytics metrics regarding artifact creation.

Proposed Solution:
Instead of relying solely on the manifest annotations and falling back to a hack, the provider should fetch the actual image configuration blob (application/vnd.oci.image.config.v1+json). According to the OCI Image Format Specification, the config blob natively contains a created timestamp property. By fetching the config blob when the annotation is missing, we can reliably determine the true creation date of the artifact.

To Reproduce

  1. Register a container repository (OCI provider) in Minder.
  2. Push a container image to the registry that does not contain the org.opencontainers.image.created annotation in its manifest.
  3. Have Minder fetch the artifact versions for that container.
  4. Observe that the CreatedAt timestamp for the artifact is set to the exact time the fetch occurred (i.e. time.Now()), rather than the actual time the image was built.

What version are you using?

main

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Nice to fix: non-critical items that should be evaluated and planned during issue triagebugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions