Skip to content

Commit

Permalink
[backend] Add missing predicate to provenance file
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoj committed Apr 25, 2022
1 parent 97ee301 commit 4c8d487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/backend/bs_worker
Original file line number Diff line number Diff line change
Expand Up @@ -3233,7 +3233,10 @@ sub generate_slsa_provenance_statement {
my $stmt = {
'_type' => "https://in-toto.io/Statement/v0.1",
'subject' => $subject,
'materials' => $buildinfo->{'materials'} || [],
'predicateType' => 'https://slsa.dev/provenance/v0.2',
'predicate' => {
'materials' => $buildinfo->{'materials'} || [],
},
};
require Build::SimpleJSON;
return Build::SimpleJSON::unparse($stmt, 'template' => $slsa_json_template, 'keepspecial' => 1);
Expand Down
5 changes: 4 additions & 1 deletion src/backend/t/1000-bs_worker.t
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ use JSON::XS ();
$got = JSON::XS::decode_json($got);
my $expected_statement = {
'_type' => 'https://in-toto.io/Statement/v0.1',
'materials' => $expected_materials,
'subject' => [
{
'digest' => {
Expand All @@ -198,5 +197,9 @@ my $expected_statement = {
}
}
],
'predicateType' => 'https://slsa.dev/provenance/v0.2',
'predicate' => {
'materials' => $expected_materials,
}
};
is_deeply($got, $expected_statement, 'generate_slsa_provenance_statement - Return value');

0 comments on commit 4c8d487

Please sign in to comment.