Add ociremote.WithSubjectDescriptor option#4940
Draft
codysoyland wants to merge 1 commit into
Draft
Conversation
WriteReferrer unconditionally HEADs the subject reference to build the referrer's subject descriptor, so attaching an attestation fails when the subject manifest is not present in the target repository. The OCI distribution spec explicitly allows manifests whose subject does not exist, and callers that store attestations apart from the image (or before it is pushed) currently have to fork the whole referrer manifest construction just to relax that one HEAD. Let callers supply the subject descriptor directly instead. The descriptor is used verbatim — the caller is responsible for providing a valid descriptor, and a digest that does not match the subject reference is rejected to catch caller bugs. Without the option, behavior is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Cody Soyland <cody.soyland@chainguard.dev>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4940 +/- ##
==========================================
- Coverage 40.10% 38.86% -1.24%
==========================================
Files 155 222 +67
Lines 10044 13620 +3576
==========================================
+ Hits 4028 5294 +1266
- Misses 5530 7554 +2024
- Partials 486 772 +286 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
codysoyland
added a commit
to chainguard-dev/terraform-provider-cosign
that referenced
this pull request
Jun 12, 2026
) Writing a bundle referrer currently requires the subject manifest to exist in the target repository: cosign's `WriteAttestationNewBundleFormat` builds the referrer's subject descriptor by unconditionally HEADing the subject reference, so the write fails when the subject is absent — even though the OCI distribution spec explicitly allows referrer manifests whose subject does not exist. Downstream status tooling hits exactly that case: it attests synthetic digests (layer blobs, pseudo-digests of non-registry entities) into an override repository where the subject manifest never exists. This adds `Statement.SubjectDescriptor`, used verbatim as the referrer's subject when supplied, while nil keeps the strict HEAD behavior. The forked write path mirrors cosign's referrer manifest byte-for-byte (pinned by a parity test) and is temporary until sigstore/cosign#4940, which adds an `ociremote.WithSubjectDescriptor` option upstream, merges. Assisted by Claude Fable 5 --------- Signed-off-by: Cody Soyland <cody.soyland@chainguard.dev> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WriteReferrer unconditionally HEADs the subject reference to build the
referrer's subject descriptor, so attaching an attestation fails when the
subject manifest is not present in the target repository — even though the
OCI distribution spec explicitly allows manifests whose subject does not
exist. This option lets callers that store attestations apart from the
image (or before it is pushed) supply the subject descriptor directly,
instead of forking the referrer manifest construction. The descriptor is
used verbatim, a digest mismatch with the subject reference is rejected,
and behavior without the option is unchanged.
Assisted by Claude Fable 5