Skip to content

Commit

Permalink
Return verified attestation in verification results (#3212)
Browse files Browse the repository at this point in the history
This commit modifies the artifact verification results to
also include the verified attestation predicate to the evaluator.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@stacklok.com>
Co-authored-by: Don Browne <dmjb@users.noreply.github.com>
  • Loading branch information
puerco and dmjb authored May 1, 2024
1 parent 7c50e65 commit 087ba6b
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions internal/engine/ingester/artifact/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,19 @@ type Ingest struct {
}

type verification struct {
IsSigned bool `json:"is_signed"`
IsVerified bool `json:"is_verified"`
Repository string `json:"repository"`
Branch string `json:"branch"`
SignerIdentity string `json:"signer_identity"`
RunnerEnvironment string `json:"runner_environment"`
CertIssuer string `json:"cert_issuer"`
IsSigned bool `json:"is_signed"`
IsVerified bool `json:"is_verified"`
Repository string `json:"repository"`
Branch string `json:"branch"`
SignerIdentity string `json:"signer_identity"`
RunnerEnvironment string `json:"runner_environment"`
CertIssuer string `json:"cert_issuer"`
Attestation *verifiedAttestation `json:"attestation,omitempty"`
}

type verifiedAttestation struct {
PredicateType string `json:"predicate_type,omitempty"`
Predicate any `json:"predicate,omitempty"`
}

// NewArtifactDataIngest creates a new artifact rule data ingest engine
Expand Down Expand Up @@ -208,6 +214,13 @@ func (i *Ingest) getVerificationResult(
verResult.RunnerEnvironment = res.Signature.Certificate.RunnerEnvironment
verResult.CertIssuer = res.Signature.Certificate.Issuer
}

if res.Statement != nil {
verResult.Attestation = &verifiedAttestation{
PredicateType: res.Statement.PredicateType,
Predicate: res.Statement.Predicate,
}
}
// Append the verification result to the list
versionResults = append(versionResults, *verResult)
}
Expand Down

0 comments on commit 087ba6b

Please sign in to comment.