Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve appropriate mediaType on package layers #3009

Open
8 tasks
marshall007 opened this issue Sep 19, 2024 · 1 comment
Open
8 tasks

Preserve appropriate mediaType on package layers #3009

marshall007 opened this issue Sep 19, 2024 · 1 comment
Labels
enhancement ✨ New feature or request

Comments

@marshall007
Copy link

marshall007 commented Sep 19, 2024

Is your feature request related to a problem? Please describe.

Currently Zarf uses a generic application/vnd.zarf.layer.v1.blob to describe every layer in the OCI manifest. This is confusing because many of these layers point to blobs with well-defined mediaTypes already.

Describe the solution you'd like

The Easy Stuff

  • images/oci-layout: application/vnd.oci.layout.header.v1+json
  • images/index.json: application/vnd.oci.image.index.v1+json
  • images/blobs/sha256/* (as appropriate):
    • application/vnd.oci.image.manifest.v1+json
    • application/vnd.oci.image.config.v1+json
    • application/vnd.oci.image.layer.v1.tar+gzip
  • zarf.yaml: => (deprecate?) alternatives:
    • rename zarf.json using application/vnd.zarf.package.config.v1+json
    • alternatively, the full ZarfPackageConfig could be included in the image config (we already have a custom application/vnd.zarf.config.v1+json)
  • checksums.txt: => (deprecate?)
    • this just seems like a plaintext version of the image manifest embedded into the image manifest?
    • if we keep it, use JSON and define something like application/vnd.zarf.package.checksums.v1+json
  • for all types: copy annotations from blob to manifest.layers[*].annotations
    • ex. this allows you to see the org.opencontainers.image.base.name (i.e. source image tag) that the image blob is associated with

The Harder Stuff

Additional context

Overloading application/vnd.zarf.layer.v1.blob makes the existing OCI manifests difficult to consume by other tooling. Preserving the mediaTypes for these layers makes it much easier to disambiguate the blobs.

For example, when implementing container image scanning, it would be great if we could just look for application/vnd.oci.image.manifest.v1+json layers as a starting point.

Along the same lines, the "harder stuff" would bring us inline with other CNCF/OpenSSF tooling and ultimately reduce the plumbing necessary to use things like trivy with Zarf packages.

@AustinAbro321
Copy link
Contributor

Thanks for making this issue! I agree using more accurate media types for layers would be a boon.

A couple notes

  • If this was implemented then during partial pulls Zarf would have to check the version the package was published with to determine which media type to pull. Currently we grab the manifests from the index.json, then alter the descriptors to the Zarf media type so we can correctly pull. We'd only need that line for packages created before this change.
  • checksums.txt is necessary unless we create an alternative. Zarf packages are used outside of OCI, and when used on a signed Zarf package which has a zarf.yaml that holds a checksum of the checksums.txt file, it verifies that no tampering has happened within the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
Status: Triage
Development

No branches or pull requests

2 participants