Skip to content
Blog

Storing SBOMs and Attestations as OCI Artifacts

Storing Software Bill of Materials (SBOMs), SLSA attestations, and security scan reports alongside container manifests in OCI registries using ORAS and BuildKit.

Published on • November 18, 2026

AI Assistant

Modern supply chain compliance requires organizations to produce a Software Bill of Materials (SBOM) and SLSA Provenance Attestations for every production release.

Storing these security documents in separate external databases or cloud buckets creates synchronization drift. To solve this, the OCI specification introduced OCI Artifacts and Subject Referrers, enabling registries to store security attestations directly attached to container image manifests.

In this deep dive, we will explore how OCI artifacts work, how BuildKit embeds SBOMs into image indexes, and how to push custom attestations using ORAS and Cosign.

The Subject Referrer Graph Architecture

+-----------------------------------------------------------------------------------+
| Container Image Manifest (Target: `myorg/app:v1.0.0`)                             |
| Digest: `sha256:7f8a91b...`                                                       |
+-----------------------------------------------------------------------------------+
                                         ▲
                         Referrers API   │   (subject: sha256:7f8a91b...)
         ┌───────────────────────────────┼──────────────────────────────┐
         │                               │                              │
+------------------+           +-------------------+           +------------------+
| OCI Artifact:    |           | OCI Artifact:     |           | OCI Signature:   |
| SPDX SBOM JSON   |           | SLSA Provenance   |           | Cosign Signature |
| (attestation)    |           | (attestation)     |           | (.sig artifact)  |
+------------------+           +-------------------+           +------------------+

Using the OCI subject field, an attestation manifest points directly to the parent image digest (sha256:7f8a91b...). When the parent image tag is promoted or moved, the attached attestations move with it automatically!

1. Native BuildKit SBOM Attestation Injection

Docker Buildx can automatically generate SPDX or CycloneDX SBOMs during image creation and attach them as OCI attestations in a single build command:

docker buildx build \
  --sbom=true \
  --provenance=mode=max \
  -t myregistry.com/myorg/app:v1.0.0 \
  --push .

Inspecting Embedded SBOM Attestations

To extract and view the embedded SBOM attestation from the registry:

docker buildx imagetools inspect myregistry.com/myorg/app:v1.0.0 --format "{{json .SBOM}}"

2. Attaching Custom SBOMs with Cosign

If you generate an SBOM using third-party CLI tools like Syft or Trivy, you can attach the resulting SPDX document to the registry image using Cosign:

# 1. Generate SPDX SBOM using Syft
syft myregistry.com/myorg/app:v1.0.0 -o spdx-json > sbom.spdx.json

# 2. Attach SBOM as an OCI attestation via Cosign
cosign attach sbom --sbom sbom.spdx.json myregistry.com/myorg/app:v1.0.0

Cosign pushes the SBOM as an OCI artifact to the registry, linking it directly to app:v1.0.0.

3. Pushing Arbitrary Files with ORAS (OCI Registry As Storage)

ORAS allows developers to push any file (PDF compliance reports, vulnerability scan JSONs, configuration tars) as an OCI artifact to any compliant registry:

# Push vulnerability report attached to container digest
oras attach \
  --artifact-type application/vnd.security.vulnerability-report+json \
  myregistry.com/myorg/app@sha256:7f8a91b2c3... \
  ./trivy-scan-report.json

Discovering Attached Referrers

To list all non-image security artifacts attached to a container digest:

oras discover myregistry.com/myorg/app@sha256:7f8a91b2c3...

Sample output:

Discovered 3 artifacts referencing sha256:7f8a91b2c3...
Digest: sha256:1111... ArtifactType: application/spdx+json
Digest: sha256:2222... ArtifactType: application/vnd.slsa.provenance+json
Digest: sha256:3333... ArtifactType: application/vnd.security.vulnerability-report+json

Benefits of Storing Security Artifacts in OCI Registries

  1. Atomic Lifecycle Alignment: When an image tag is deleted or garbage-collected, attached SBOMs and attestations are automatically purged alongside it.
  2. Unified Access Control: Authentication and RBAC permissions applied to the image repository automatically protect the associated security attestations.
  3. Runtime Policy Gate Verification: Kubernetes admission controllers can query the OCI Referrers API to verify that an image has an attached SBOM and passed CVE thresholds before allowing the Pod to start.

Summary

Co-locating SBOMs, SLSA provenance records, and digital signatures alongside container manifests in OCI registries establishes a single, immutable source of truth for software supply chain security.