An SBOM pushed to an OCI registry with a subject field naming an image is missing when a deploy job lists that image's referrers; what do you check?
answer
- same repository, exact digest
- index digest versus platform manifest
- API or fallback tag
- filters and pages
basics
~20 sCheck the job queries the same repository and the exact digest in the SBOM's subject, whether the registry serves the referrers API or the sha256-<hex> fallback tag was updated, and whether an artifactType filter or paging hides it.
solid answer
~50 s`GET /v2/<name>/referrers/<digest>` returns an image index of manifests **in the same repository** whose `subject` names **exactly** that digest. So I check: the SBOM went to the image's repository, not a separate one; its `subject` matches the queried digest, since an SBOM attached to one platform's manifest does not appear under the image index digest; and whether the registry supports the API. A supporting registry answers a push carrying `subject` with an `OCI-Subject` header and never returns `404` for a referrers query. Without it, the pushing client must update a fallback tag such as `sha256-<hex>`, and concurrent pushers can overwrite each other. Then filters: without `OCI-Filters-Applied: artifactType` the list is unfiltered, and an SBOM lacking `artifactType` is listed under its config media type. Last, `Link` paging, and whether the image was copied in without its referrers.
code
http · 18 linesGET /v2/team/api/referrers/sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270?artifactType=application/vnd.example.sbom.v1
HTTP/1.1 200 OK
Content-Type: application/vnd.oci.image.index.v1+json
OCI-Filters-Applied: artifactType
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.index.v1+json",
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 1234,
"digest": "sha256:a1a1a1...",
"artifactType": "application/vnd.example.sbom.v1"
}
]
}go deeper
Recall that an SBOM or report can point at an image through a subject field, and that the registry can list what points at a digest.
Explain the referrers response: an image index of descriptors with artifactType and annotations, the artifactType filter, and paging through the Link header.
Diagnose a missing referrer methodically: repository, exact digest, API support versus the fallback tag and its races, filter headers, paging and copies that left referrers behind.
Decide whether registries without the referrers API are acceptable in your estate, given that the fallback tag is client-maintained and can lose entries under concurrent pushes.
## How a registry links an artifact to an image The OCI image spec defines an optional **`subject`** field on the image manifest and the image index: a descriptor of another manifest. It is a weak association; the SBOM, signature or report points at the image, and the image is never modified. Distribution-spec 1.1 added the **referrers API** to answer the reverse question, "what points at this digest?": - `GET /v2/<name>/referrers/<digest>` returns `200 OK` with an image index (`application/vnd.oci.image.index.v1+json`) whose `manifests` list holds one descriptor per referring manifest **in the same `<name>` repository**. - Each descriptor carries the referrer's `artifactType`; when an image manifest has none, the registry reports its **config media type** instead; for an index without one the field is omitted. Annotations are copied in. - A registry supporting the API **must not** answer `404`; no referrers means an empty list. - A registry **must** accept a manifest whose `subject` names a manifest not yet in the repository, so artifacts and images can be pushed in either order. - When it processes `subject`, a supporting registry returns `OCI-Subject: <digest>` on the push. ## Filtering and paging - `?artifactType=<type>` asks the registry to filter. Registries **should** support it, and when they apply it they **must** return `OCI-Filters-Applied: artifactType`. No header means the list is unfiltered and the client has to filter it. - When the list does not fit one response, the registry sends a `Link` header with `rel="next"`. A client that ignores it sees only the first page. ## Registries without the API: the fallback tag On a registry without the referrers API, the query returns `404` and clients must fall back to a **referrers tag**: the digest's algorithm, a hyphen, and its encoded part, for example `sha256-<64 hex characters>`, pointing at an image index maintained **by clients**. On every push of a manifest with `subject` that did not get `OCI-Subject` back, the client must: 1. pull the current index from the referrers tag, starting empty on `404`; 2. skip it if the descriptor is already present; 3. append a descriptor with the pushed manifest's `artifactType` (or config media type) and annotations; 4. push the updated index back to the same tag, optionally with a conditional request. This is read-modify-write by independent clients. The spec warns that simultaneous updates can cause race conditions and data loss: two pipelines attaching an SBOM and a scan report at once can each overwrite the other's entry. ## A diagnosis checklist | Symptom | Likely cause | Check | |---|---|---| | Empty list, SBOM exists | SBOM pushed to a separate repository | Referrers are listed per repository | | Empty list for the multi-platform image | `subject` names one platform's manifest, query uses the index digest (or the reverse) | Compare the SBOM's `subject.digest` with the queried digest | | `404` from the referrers endpoint | Registry lacks the API | Read the `sha256-<hex>` tag; was it updated? | | SBOM appeared once, then vanished | Lost update on the fallback tag from concurrent pushers | Re-attach; use conditional pushes or a registry with the API | | Other artifact types shown, SBOM missing | Filter mismatch: SBOM has no `artifactType`, so it is typed by config media type | Query unfiltered and inspect | | Partial list | `Link` pagination not followed | Follow `rel="next"` | | Image present, no referrers at all | Image copied in by digest without its referrers | Copy referrers too; ORAS's `cp -r` does | ## Upgrades and copies When a registry enables the referrers API, it **must** include manifests already listed in fallback-tag indexes (with a valid `subject`), **may** include every older manifest with a `subject`, and **must** include everything pushed afterwards. Copying an image by digest to another repository or registry copies the image's manifests and blobs; the SBOM is a separate manifest that points at the image, so it travels only when the copy tool walks referrers deliberately. ## Takeaways - Referrers are keyed on **one repository and one exact digest**. - Know whether your registry serves the API; the fallback tag is client-maintained and racy. - Check filter headers and pagination before concluding an artifact is missing.
- Why does the spec let a registry accept an SBOM whose subject image has not been pushed yet?So clients can push an image and its referrers in either order, for example from parallel pipeline steps or a copy that moves referrers before the image. The distribution spec says a registry must initially accept an otherwise valid manifest whose subject references a manifest that does not exist in the repository.
- What must a registry do about old fallback-tag entries when it turns on the referrers API?It must include manifests already listed in image indexes under the referrers tag scheme, provided they have a valid subject. It may also include every older manifest carrying a subject, and it must include all such manifests pushed after the API is enabled.
- Why is the fallback tag risky when several pipelines attach artifacts to one image?Each client pulls the index behind the sha256-<hex> tag, appends its descriptor and pushes it back. Two clients doing this at once can each overwrite the other's update, losing an entry. The spec leaves protection to clients: conditional pushes where the registry supports ETags, or a registry that serves the referrers API.
- The referrers API searches every repository in the registry for matching subjects.
- A registry without the referrers API cannot store manifests that carry a subject field.
- An SBOM attached to the image index also appears under each platform manifest's digest.
- Copying an image by digest to another registry carries its SBOMs along automatically.
- A referrers response without OCI-Filters-Applied has still been filtered by artifactType.
- The registry rejects a manifest whose subject image does not exist yet.