Update release verify commands to use sentinel value

Co-authored-by: bdehamer <398027+bdehamer@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-10-22 15:26:36 +00:00
parent 7720137456
commit 74ac20671c
3 changed files with 7 additions and 2 deletions

View file

@ -41,6 +41,11 @@ func OnGetByDigestSuccess(params FetchParams) ([]*Attestation, error) {
att3 := makeTestReleaseAttestation()
attestations := []*Attestation{&att1, &att2}
if params.PredicateType != "" {
// "release" is a sentinel value that returns all release attestations (v0.1, v0.2, etc.)
// This mimics the GitHub API behavior which handles this server-side
if params.PredicateType == "release" {
return []*Attestation{&att3}, nil
}
if params.PredicateType == "https://in-toto.io/attestation/release/v0.1" {
attestations = append(attestations, &att3)
}

View file

@ -147,7 +147,7 @@ func verifyAssetRun(config *VerifyAssetConfig) error {
// Find attestations for the release tag SHA
attestations, err := config.AttClient.GetByDigest(api.FetchParams{
Digest: releaseRefDigest.DigestWithAlg(),
PredicateType: shared.ReleasePredicateType,
PredicateType: "release",
Owner: baseRepo.RepoOwner(),
Repo: baseRepo.RepoOwner() + "/" + baseRepo.RepoName(),
// TODO: Allow this value to be set via a flag.

View file

@ -135,7 +135,7 @@ func verifyRun(config *VerifyConfig) error {
// Find all the attestations for the release tag SHA
attestations, err := config.AttClient.GetByDigest(api.FetchParams{
Digest: releaseRefDigest.DigestWithAlg(),
PredicateType: shared.ReleasePredicateType,
PredicateType: "release",
Owner: baseRepo.RepoOwner(),
Repo: baseRepo.RepoOwner() + "/" + baseRepo.RepoName(),
Initiator: "github",