Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return verified attestation in verification results #3212

Merged
merged 2 commits into from
May 1, 2024
Merged
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
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