Return policy input with verification result (#56)

This commit is contained in:
Jonny Stoten
2024-06-17 17:28:22 +01:00
committed by GitHub
parent 1d9e14b99f
commit 0d0d86854c
2 changed files with 6 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ func ToPolicyResult(p *policy.Policy, input *policy.PolicyInput, result *policy.
Policy: p,
Outcome: outcome,
Violations: result.Violations,
Input: input,
VSA: &intoto.Statement{
StatementHeader: intoto.StatementHeader{
PredicateType: attestation.VSAPredicateType,

View File

@@ -106,6 +106,11 @@ func TestVSA(t *testing.T) {
assert.Equal(t, OutcomeSuccess, results.Outcome)
assert.Empty(t, results.Violations)
if assert.NotNil(t, results.Input) {
assert.Equal(t, "sha256:da8b190665956ea07890a0273e2a9c96bfe291662f08e2860e868eef69c34620", results.Input.Digest)
assert.False(t, results.Input.IsCanonical)
}
assert.Equal(t, intoto.StatementInTotoV01, results.VSA.Type)
assert.Equal(t, attestation.VSAPredicateType, results.VSA.PredicateType)
assert.Len(t, results.VSA.Subject, 1)