Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/cmd/attestation/api/mock_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ func OnGetByDigestSuccess(params FetchParams) ([]*Attestation, error) {
att3 := makeTestReleaseAttestation()
attestations := []*Attestation{&att1, &att2}
if params.PredicateType != "" {
if params.PredicateType == "https://in-toto.io/attestation/release/v0.1" {
attestations = append(attestations, &att3)
// "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
}
return FilterAttestations(params.PredicateType, attestations)
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/cmd/release/shared/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import (
"google.golang.org/protobuf/encoding/protojson"
)

const ReleasePredicateType = "https://in-toto.io/attestation/release/v0.1"

type Verifier interface {
// VerifyAttestation verifies the attestation for a given artifact
VerifyAttestation(art *artifact.DigestedArtifact, att *api.Attestation) (*verification.AttestationProcessingResult, error)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/release/verify-asset/verify_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/release/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down