diff --git a/lib/github/provenance_test.go b/lib/github/provenance_test.go index c9515750..d1c5dd93 100644 --- a/lib/github/provenance_test.go +++ b/lib/github/provenance_test.go @@ -396,7 +396,7 @@ func assertInvocation(assert *assert.Assertions, recipe intoto.Invocation) { assert.Equal(0, recipe.DefinedInMaterial) assert.Equal("", recipe.ConfigSource.EntryPoint) assert.Nil(recipe.Environment) - assert.Nil(recipe.Arguments) + assert.Nil(recipe.Parameters) } func assertMetadata(assert *assert.Assertions, meta intoto.Metadata, gh github.Context, repoURL string) { @@ -404,7 +404,7 @@ func assertMetadata(assert *assert.Assertions, meta intoto.Metadata, gh github.C assert.NoError(err) assert.WithinDuration(time.Now().UTC(), bft, 1200*time.Millisecond) assert.Equal(fmt.Sprintf("%s/%s/%s", repoURL, "actions/runs", gh.RunID), meta.BuildInvocationID) - assert.Equal(true, meta.Completeness.Arguments) + assert.Equal(true, meta.Completeness.Parameters) assert.Equal(false, meta.Completeness.Environment) assert.Equal(false, meta.Completeness.Materials) assert.Equal(false, meta.Reproducible) diff --git a/lib/intoto/intoto.go b/lib/intoto/intoto.go index 5ade7207..ce0af0af 100644 --- a/lib/intoto/intoto.go +++ b/lib/intoto/intoto.go @@ -57,7 +57,7 @@ func WithMetadata(buildInvocationID string) StatementOption { return func(s *Statement) { s.Predicate.Metadata = Metadata{ Completeness: Completeness{ - Arguments: true, + Parameters: true, Environment: false, Materials: false, }, @@ -69,7 +69,7 @@ func WithMetadata(buildInvocationID string) StatementOption { } // WithInvocation sets the Predicate Invocation and Materials -func WithInvocation(buildType, entryPoint string, environment json.RawMessage, arguments json.RawMessage, materials []Item) StatementOption { +func WithInvocation(buildType, entryPoint string, environment json.RawMessage, parameters json.RawMessage, materials []Item) StatementOption { return func(s *Statement) { s.Predicate.BuildType = buildType s.Predicate.Invocation = Invocation{ @@ -78,7 +78,7 @@ func WithInvocation(buildType, entryPoint string, environment json.RawMessage, a URI: materials[0].URI, Digest: materials[0].Digest, }, - Arguments: arguments, + Parameters: parameters, // Subject to change and simplify https://github.com/slsa-framework/slsa/issues/178 // Index in materials containing the recipe steps that are not implied by recipe.type. For example, if the recipe type were "make", then this would point to the source containing the Makefile, not the make program itself. // Omit this field (or use null) if the recipe doesn't come from a material. @@ -142,7 +142,7 @@ type Metadata struct { type Invocation struct { DefinedInMaterial int `json:"definedInMaterial"` ConfigSource ConfigSource `json:"configSource"` - Arguments json.RawMessage `json:"arguments"` + Parameters json.RawMessage `json:"parameters"` Environment json.RawMessage `json:"environment"` } @@ -156,7 +156,7 @@ type ConfigSource struct { // Completeness Indicates that the builder claims certain fields in this message to be complete. type Completeness struct { - Arguments bool `json:"arguments"` + Parameters bool `json:"parameters"` Environment bool `json:"environment"` Materials bool `json:"materials"` } diff --git a/lib/intoto/intoto_test.go b/lib/intoto/intoto_test.go index 25027df5..85e4db35 100644 --- a/lib/intoto/intoto_test.go +++ b/lib/intoto/intoto_test.go @@ -51,7 +51,7 @@ func TestSLSAProvenanceStatement(t *testing.T) { bft, err := time.Parse(time.RFC3339, m.BuildFinishedOn) assert.NoError(err) assert.WithinDuration(time.Now().UTC(), bft, 1200*time.Millisecond) - assert.Equal(Completeness{Arguments: true, Environment: false, Materials: false}, stmt.Predicate.Metadata.Completeness) + assert.Equal(Completeness{Parameters: true, Environment: false, Materials: false}, stmt.Predicate.Metadata.Completeness) assert.False(m.Reproducible) provenanceActionMaterial := []Item{ @@ -72,10 +72,10 @@ func TestSLSAProvenanceStatement(t *testing.T) { provenanceActionMaterial, ), ) - assertStatement(assert, stmt, builderID, buildType, provenanceActionMaterial) + assertStatement(assert, stmt, builderID, buildType, provenanceActionMaterial, nil) } -func assertStatement(assert *assert.Assertions, stmt *Statement, builderID, buildType string, material []Item) { +func assertStatement(assert *assert.Assertions, stmt *Statement, builderID, buildType string, material []Item, parameters json.RawMessage) { i := stmt.Predicate.Invocation assert.Equal(SlsaPredicateType, stmt.PredicateType) assert.Equal(StatementType, stmt.Type) @@ -83,7 +83,7 @@ func assertStatement(assert *assert.Assertions, stmt *Statement, builderID, buil assert.Equal(builderID, stmt.Predicate.Builder.ID) assert.Equal(buildType, stmt.Predicate.BuildType) assertConfigSource(assert, i.ConfigSource, stmt.Predicate.Materials) - assert.Nil(i.Arguments) + assert.Equal(parameters, i.Parameters) assert.Equal(0, i.DefinedInMaterial) assert.Equal(material, stmt.Predicate.Materials) } @@ -107,6 +107,7 @@ func TestSLSAProvenanceStatementJSON(t *testing.T) { } } ]` + parametersJSON := `{ "inputs": { "skip_integration": true } }` var material []Item err := json.Unmarshal([]byte(materialJSON), &material) assert.NoError(err) @@ -135,7 +136,7 @@ func TestSLSAProvenanceStatementJSON(t *testing.T) { "sha1": "a3bc1c27230caa1cc3c27961f7e9cab43cd208dc" } }, - "parameters": null, + "parameters": %s, "environment": null }, "buildConfig": null, @@ -152,10 +153,10 @@ func TestSLSAProvenanceStatementJSON(t *testing.T) { "materials": %s } } -`, builderID, buildType, materialJSON) +`, builderID, buildType, parametersJSON, materialJSON) var stmt Statement err = json.Unmarshal([]byte(jsonStatement), &stmt) assert.NoError(err) - assertStatement(assert, &stmt, builderID, buildType, material) + assertStatement(assert, &stmt, builderID, buildType, material, []byte(parametersJSON)) }