Skip to content

Commit 0b00f23

Browse files
sarahecraddockSarah Craddockdependabot[bot]eddie-knight
authored
feat: Support new SCI assessment change functionality (#82)
* Updates to support assessment change functionality * chore(deps): bump actions/setup-go in the dependencies group (#81) Bumps the dependencies group with 1 update: [actions/setup-go](https://github.com/actions/setup-go). Updates `actions/setup-go` from 5.3.0 to 5.4.0 - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v5.3.0...v5.4.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Updated test data to be compatible with SCI v0.3+ Signed-off-by: Eddie Knight <knight@linux.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Eddie Knight <knight@linux.com> Co-authored-by: Sarah Craddock <sarahcra@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eddie Knight <knight@linux.com>
1 parent 7ee67fe commit 0b00f23

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.23.4
55
require (
66
github.com/hashicorp/go-hclog v1.6.3
77
github.com/hashicorp/go-plugin v1.6.3
8-
github.com/revanite-io/sci v0.1.9
8+
github.com/revanite-io/sci v0.3.1
99
github.com/spf13/cobra v1.9.1
1010
github.com/spf13/viper v1.19.0
1111
gopkg.in/yaml.v3 v3.0.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h
5757
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5858
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
5959
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
60-
github.com/revanite-io/sci v0.1.9 h1:DnQ3NB1pqLhbRFYUM6CoA6hYbIJtRas1M6bJbsWL5VA=
61-
github.com/revanite-io/sci v0.1.9/go.mod h1:KNBMtb28TKYJ0aq6P0jX1XaIBYQdAziTvnI7uU2H+5Q=
60+
github.com/revanite-io/sci v0.3.1 h1:ggv0wyfFZm4jTTNUPvfho63eCJD0ux4hb6uMXvOJT74=
61+
github.com/revanite-io/sci v0.3.1/go.mod h1:KNBMtb28TKYJ0aq6P0jX1XaIBYQdAziTvnI7uU2H+5Q=
6262
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
6363
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
6464
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=

pluginkit/evaluation_suite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
type TestSet func() (result layer4.ControlEvaluation)
1919

20-
// TestSuite is a struct that contains the results of all ControlEvaluations, orgainzed by name
20+
// TestSuite is a struct that contains the results of all ControlEvaluations, organized by name
2121
type EvaluationSuite struct {
2222
Name string // Name is the name of the suite
2323
Catalog_Id string // Catalog_Id associates this suite with an catalog

pluginkit/test_data.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ func passingEvaluation() (evaluation *layer4.ControlEvaluation) {
4242
"fake-target-name",
4343
"this change doesn't do anything",
4444
nil,
45-
func() (interface{}, error) {
45+
func(interface{}) (interface{}, error) {
4646
return nil, nil
4747
},
48-
func() error {
48+
func(interface{}) error {
4949
return nil
5050
},
5151
)
@@ -103,10 +103,10 @@ func corruptedEvaluation() (evaluation *layer4.ControlEvaluation) {
103103
"fake-target-name",
104104
"this change doesn't do anything",
105105
nil,
106-
func() (interface{}, error) {
107-
return nil, fmt.Errorf("corrupted")
106+
func(interface{}) (interface{}, error) {
107+
return nil, nil
108108
},
109-
func() error {
109+
func(interface{}) error {
110110
return fmt.Errorf("corrupted")
111111
},
112112
)
@@ -147,9 +147,9 @@ func step_checkPayload(payloadData interface{}, _ map[string]*layer4.Change) (re
147147
return layer4.Unknown, "Not implemented"
148148
}
149149

150-
func step_Pass(_ interface{}, changes map[string]*layer4.Change) (result layer4.Result, message string) {
150+
func step_Pass(data interface{}, changes map[string]*layer4.Change) (result layer4.Result, message string) {
151151
if changes != nil && changes["good-change"] != nil {
152-
changes["good-change"].Apply()
152+
changes["good-change"].Apply("target_name", "target_object", data)
153153
}
154154
return layer4.Passed, "This step always passes"
155155
}
@@ -166,8 +166,8 @@ func step_Unknown(_ interface{}, _ map[string]*layer4.Change) (result layer4.Res
166166
return layer4.Unknown, "This step always returns unknown"
167167
}
168168

169-
func step_Corrupted(_ interface{}, changes map[string]*layer4.Change) (result layer4.Result, message string) {
170-
changes["corrupted-change"].Apply()
169+
func step_Corrupted(data interface{}, changes map[string]*layer4.Change) (result layer4.Result, message string) {
170+
changes["corrupted-change"].Apply("target_name", "target_object", data)
171171
return layer4.Unknown, "This step always returns unknown and applies a corrupted change"
172172
}
173173

utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func WriteAllowed(path string) error {
110110
func GetExecutableName() string {
111111
execAbsPath, err := os.Executable()
112112
if err != nil {
113-
log.Fatalf("[ERROR] Critical error ocurred while getting executable name")
113+
log.Fatalf("[ERROR] Critical error occurred while getting executable name")
114114
}
115115

116116
execName := filepath.Base(execAbsPath)

0 commit comments

Comments
 (0)