Description
Describe the solution you'd like:
I would like to add the ability to attach attestations e.g. in-toto to OCI artifacts, such as container images, using a workflow similar to cosign attach attestation. This would involve supporting standardized attestation formats (e.g., DSSE-wrapped in-toto statements), storing them in the OCI registry as artifact references, and making them discoverable alongside the container image.
User value:
This feature enables supply chain security and compliance practices by allowing developers and CI/CD systems to attest to specific steps or properties of a container image (e.g., build provenance, vulnerability scanning results, policy compliance). It allows consumers of the artifact to verify its integrity and trustworthiness. This is especially valuable in regulated environments or zero-trust architectures air gapped environments.
Expected behavior:
Users should be able to attach an attestation (e.g., a signed provenance in-toto statement) to an OCI artifact using the CLI, and this attestation should be discoverable and retrievable through the OCI registry. Before attaching the attestation(s) to the artifact a cryptographic verification sure verify that the attestation belongs to the artifact. Verification tools should be able to fetch and validate these attestations easily tying the artifact to the attestation.
Proposed solution:
Implement a CLI command similar to:
attach attestation --artifact --attestation --type
Use the OCI referrers API to store the attestation as a related artifact.
Support in-toto statements wrapped in DSSE envelopes, with appropriate media types (application/vnd.in-toto+json, application/vnd.dsse.envelope.v1+json).
# Generate attestation about the build process
witness run --step build -k <SIGNING_KEY> -o build-attestation.json -- docker build .
# Attach the attestation to the docker image with verification
witness attach attestation --source docker --attestation build-attestation.json myapp:latest
witness attach attestation --source tar --attestation build-attestation.json image.tar.gz
Anything else you would like to add:
Consider making the attestation discovery and validation pluggable, so teams can integrate with their policy engines or CI systems.
Testing changes required:
Unit and integration tests for attaching and retrieving attestations via the OCI registry.
End-to-end tests simulating a CI/CD pipeline generating and attaching attestations.
Documentation changes required:
CLI usage guide for attach attestation command.
Examples for generating in-toto attestations and attaching them.
Documentation on supported media types and formats.
Guide on verifying attached attestations using external tools.
References
Cosign attach
regclient