Skip to content

Commit

Permalink
combine the slsa version with the inputAttestations and remove resour…
Browse files Browse the repository at this point in the history
…ceUri since its duplicated in subjects
  • Loading branch information
joejstuart committed Nov 3, 2023
1 parent d379f70 commit fc648fc
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions internal/attestation/vsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

const (
// Make it visible elsewhere
PredicateVSAProvenance = "https://slsa.dev/verification_summary/v1"
PredicateVSAProvenance = "https://enterprisecontract.dev//verification_summary/v1"
StatmentVSA = "https://in-toto.io/Statement/v1"
)

Expand All @@ -43,7 +43,8 @@ type policySource struct {
}

type attestationSource struct {
digest map[string]string
version string
digest map[string]string
}

type predicate struct {
Expand Down Expand Up @@ -87,38 +88,29 @@ func VsaFromImageValidation(results []evaluator.Outcome, policies []source.Polic
}
}

var slsaVersion string
var digest map[string]string
var subject []in_toto.Subject
var subjects []in_toto.Subject
var inputAttestations []attestationSource
for _, sp := range attestations {
slsaVersion = sp.PredicateType()
digest = sp.Digest()
subject = sp.Subject()
inputAttestations = append(inputAttestations, attestationSource{version: sp.PredicateType(), digest: sp.Digest()})
subjects = append(subjects, sp.Subject()...)
}

return ProvenanceStatementVSA{
StatementHeader: in_toto.StatementHeader{
Type: StatmentVSA,
PredicateType: PredicateVSAProvenance,
Subject: subject,
Subject: subjects,
},
Predicate: predicate{
Verifier: map[string]string{
"id": "ec",
},
TimeVerified: time.Now().String(),
// need to check on this. Sounds like it should be the same as the subject, but not compatible types
ResourceUri: subject[0].Name,
Policies: verifiedPolicies,
InputAttestations: []attestationSource{
{
digest: digest,
},
},
TimeVerified: time.Now().String(),
Policies: verifiedPolicies,
InputAttestations: inputAttestations,
VerificationResult: verificationResult,
VerifiedRules: verifiedLevels,
VerifiedCollections: verifiedCollections,
SlsaVersion: slsaVersion,
},
}, nil
}

0 comments on commit fc648fc

Please sign in to comment.