diff --git a/docs/content/en/docs/core-components/api-design.md b/docs/content/en/docs/core-components/api-design.md index 5903be6a..573fc4f3 100644 --- a/docs/content/en/docs/core-components/api-design.md +++ b/docs/content/en/docs/core-components/api-design.md @@ -372,7 +372,7 @@ None @endjson ``` -Module is the executing module name that will do the executer call. +Module is the executing module name that will do the executor call. Category defines what kind of step is executed: ```plantuml diff --git a/docs/content/en/docs/core-components/decomposer.md b/docs/content/en/docs/core-components/decomposer.md index 36fb469c..9229476e 100644 --- a/docs/content/en/docs/core-components/decomposer.md +++ b/docs/content/en/docs/core-components/decomposer.md @@ -69,7 +69,7 @@ loop for all playbook steps decomposer -> decomposer: parse command decomposer -> exe: execute command - note over exe: correct executer is selected + note over exe: correct executor is selected ... Time has passed ... decomposer <-- exe end loop diff --git a/docs/content/en/docs/core-components/executer.md b/docs/content/en/docs/core-components/executer.md index 23597e48..8a9e8b55 100644 --- a/docs/content/en/docs/core-components/executer.md +++ b/docs/content/en/docs/core-components/executer.md @@ -1,10 +1,10 @@ --- -title: Executer +title: Executor weight: 5 categories: [architecture] tags: [] description: > - Design of the SOARCA step executer + Design of the SOARCA step executor --- ## Components diff --git a/docs/content/en/docs/core-components/modules.md b/docs/content/en/docs/core-components/modules.md index 8d0ae4f9..df364169 100644 --- a/docs/content/en/docs/core-components/modules.md +++ b/docs/content/en/docs/core-components/modules.md @@ -1,13 +1,13 @@ --- -title: Executer Modules +title: Executor Modules weight: 6 categories: [architecture] tags: [components] description: > - Native executer modules + Native executor modules --- -Executer modules are part of the SOARCA core. Executer modules perform the actual commands in CACAO playbook steps. +Executor modules are part of the SOARCA core. Executor modules perform the actual commands in CACAO playbook steps. ## Native modules in SOARCA The following capability modules are currently defined in SOARCA: diff --git a/docs/content/en/docs/core-components/reporting.md b/docs/content/en/docs/core-components/reporting.md index 809e7068..ac3cdafc 100644 --- a/docs/content/en/docs/core-components/reporting.md +++ b/docs/content/en/docs/core-components/reporting.md @@ -73,7 +73,7 @@ Cache .up.|> IDownStreamReporter The reporting logic and extensibility is implemented in the SOARCA architecture by means of reporting interfaces. At this stage, we implement an *IWorkflowReporter* to push information about the entire workflow to be executed, and an *IStepReporter* to push step-specific information as the steps of the workflow are executed. -A high level *Reporter* component will implement both interfaces, and maintain the list of *DownStreamRepporter*s activated for the SOARCA instance. The *Reporter* class will invoke all reporting functions for each active reporter. The *Executer* and *Decomposer* components will be injected each with the Reporter though, as interface of respectively workflow reporter, and step reporter, to keep the reporting scope separated. +A high level *Reporter* component will implement both interfaces, and maintain the list of *DownStreamRepporter*s activated for the SOARCA instance. The *Reporter* class will invoke all reporting functions for each active reporter. The *Executor* and *Decomposer* components will be injected each with the Reporter though, as interface of respectively workflow reporter, and step reporter, to keep the reporting scope separated. The *DownStream* reporters will implement push-based reporting functions specific for the reporting target, as shown in the *IDownStreamReporter* interface. Internal components to SOARCA, and third-party tool reporters, will thus implement the *IDownStreamReporter* interface. @@ -89,7 +89,7 @@ SOARCA implements internally reporting modules to handle database and caches rep ### Cache reporter -The *Cache* reporter mediates between [decomposer](https://cossas.github.io/SOARCA/docs/core-components/decomposer/) and [executors](https://cossas.github.io/SOARCA/docs/core-components/executer/), [database](https://cossas.github.io/SOARCA/docs/core-components/database/), and reporting APIs. As *DownStreamReporter*, the *Cache* stores workflow and step reports in-memory for an ongoing execution. As *IExecutionInformant*, the *Cache* provides information to the reporting API. The schema below shows how it is positioned in the SOARCA architecture. +The *Cache* reporter mediates between [decomposer](https://cossas.github.io/SOARCA/docs/core-components/decomposer/) and [executors](https://cossas.github.io/SOARCA/docs/core-components/executor/), [database](https://cossas.github.io/SOARCA/docs/core-components/database/), and reporting APIs. As *DownStreamReporter*, the *Cache* stores workflow and step reports in-memory for an ongoing execution. As *IExecutionInformant*, the *Cache* provides information to the reporting API. The schema below shows how it is positioned in the SOARCA architecture. ```plantuml @startuml diff --git a/docs/content/en/docs/core-components/soarca-application-design.md b/docs/content/en/docs/core-components/soarca-application-design.md index ea080164..166f45c9 100644 --- a/docs/content/en/docs/core-components/soarca-application-design.md +++ b/docs/content/en/docs/core-components/soarca-application-design.md @@ -103,7 +103,7 @@ Interface IPlaybookDatabase Interface IDatabase Interface ICapability Interface IDecomposer -Interface IExecuter +Interface IExecutor class Controller class Decomposer @@ -111,14 +111,14 @@ class PlaybookDatabase class Status class Mongo class Capability -Class Executer +Class Executor IPlaybook <|.. Playbook ITrigger <|.. Trigger IStatus <|.. Status ICapability <|.. Capability -IExecuter <|.. Executer +IExecutor <|.. Executor Trigger -> IPlaybookDatabase IPlaybookDatabase <- Playbook IPlaybookDatabase <|.. PlaybookDatabase @@ -126,8 +126,8 @@ IDatabase <-up- PlaybookDatabase IDatabase <|.. Mongo IDecomposer <- Trigger IDecomposer <|.. Decomposer -IExecuter <- Decomposer -ICapability <- Executer +IExecutor <- Decomposer +ICapability <- Executor @enduml ``` @@ -155,7 +155,7 @@ interface ITrigger{ Interface IPlaybookDatabase Interface IDecomposer -Interface IExecuter +Interface IExecutor class Trigger class Controller @@ -173,7 +173,7 @@ IPlaybookDatabase <|.. PlaybookDatabase IDecomposer <- Trigger IDecomposer <|.. Decomposer -IExecuter -> Decomposer +IExecutor -> Decomposer ``` diff --git a/docs/content/en/docs/soarca-extensions/fin-protocol.md b/docs/content/en/docs/soarca-extensions/fin-protocol.md index b1c62ce4..898c34a1 100644 --- a/docs/content/en/docs/soarca-extensions/fin-protocol.md +++ b/docs/content/en/docs/soarca-extensions/fin-protocol.md @@ -141,7 +141,7 @@ The message is used to register a fin to SOARCA. It has the following payload. "capabilities": [ { "capability_id": "uuid", - "name": "ssh executer", + "name": "ssh executor", "version": "0.1.0", "step": { "type": "action", diff --git a/pkg/core/capability/http/http.go b/pkg/core/capability/http/http.go index e9133a21..6ecb1346 100644 --- a/pkg/core/capability/http/http.go +++ b/pkg/core/capability/http/http.go @@ -9,7 +9,7 @@ import ( "soarca/pkg/utils/http" ) -// Receive HTTP API command data from decomposer/executer +// Receive HTTP API command data from decomposer/executor // Validate HTTP API call // Run HTTP API call // Return response diff --git a/pkg/core/decomposer/decomposer.go b/pkg/core/decomposer/decomposer.go index c73b74ac..9dc6a1cc 100644 --- a/pkg/core/decomposer/decomposer.go +++ b/pkg/core/decomposer/decomposer.go @@ -41,8 +41,8 @@ func init() { } func New(actionExecutor executors.IActionExecutor, - playbookActionExecutor executors.IPlaybookExecuter, - condition executors.IConditionExecuter, + playbookActionExecutor executors.IPlaybookExecutor, + condition executors.IConditionExecutor, guid guid.IGuid, reporter reporter.IWorkflowReporter, time timeUtil.ITime) *Decomposer { @@ -60,8 +60,8 @@ type Decomposer struct { playbook cacao.Playbook details ExecutionDetails actionExecutor executors.IActionExecutor - playbookActionExecutor executors.IPlaybookExecuter - conditionExecutor executors.IConditionExecuter + playbookActionExecutor executors.IPlaybookExecutor + conditionExecutor executors.IConditionExecutor guid guid.IGuid reporter reporter.IWorkflowReporter time timeUtil.ITime diff --git a/pkg/core/executors/action/action.go b/pkg/core/executors/action/action.go index 7406a76c..dfcf6c93 100644 --- a/pkg/core/executors/action/action.go +++ b/pkg/core/executors/action/action.go @@ -28,7 +28,7 @@ func New(capabilities map[string]capability.ICapability, reporter reporter.IStep return &instance } -type IExecuter interface { +type IExecutor interface { Execute(metadata execution.Metadata, step executors.PlaybookStepMetadata) (cacao.Variables, error) } diff --git a/pkg/core/executors/action/action_executor_test.go b/pkg/core/executors/action/action_executor_test.go index 653569cc..8d762418 100644 --- a/pkg/core/executors/action/action_executor_test.go +++ b/pkg/core/executors/action/action_executor_test.go @@ -25,7 +25,7 @@ func TestExecuteStep(t *testing.T) { capabilities := map[string]capability.ICapability{"mock-ssh": mock_ssh, "http-api": mock_http} - executerObject := New(capabilities, mock_reporter, mock_time) + executorObject := New(capabilities, mock_reporter, mock_time) executionId, _ := uuid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") playbookId := "playbook--d09351a2-a075-40c8-8054-0b7c423db83f" stepId := "step--81eff59f-d084-4324-9e0a-59e353dbd28f" @@ -99,7 +99,7 @@ func TestExecuteStep(t *testing.T) { Return(cacao.NewVariables(expectedVariables), nil) - _, err := executerObject.Execute(metadata, + _, err := executorObject.Execute(metadata, actionMetadata) assert.Equal(t, err, nil) @@ -116,7 +116,7 @@ func TestExecuteActionStep(t *testing.T) { capabilities := map[string]capability.ICapability{"ssh": mock_ssh, "http-api": mock_http} - executerObject := New(capabilities, mock_reporter, mock_time) + executorObject := New(capabilities, mock_reporter, mock_time) executionId, _ := uuid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") playbookId := "playbook--d09351a2-a075-40c8-8054-0b7c423db83f" stepId := "step--81eff59f-d084-4324-9e0a-59e353dbd28f" @@ -166,7 +166,7 @@ func TestExecuteActionStep(t *testing.T) { variables: cacao.NewVariables(expectedVariables), agent: agent} - _, err := executerObject.executeCommands(metadata, + _, err := executorObject.executeCommands(metadata, data) assert.Equal(t, err, nil) @@ -182,7 +182,7 @@ func TestNonExistingCapabilityStep(t *testing.T) { capabilities := map[string]capability.ICapability{"ssh": mock_ssh, "http-api": mock_http} - executerObject := New(capabilities, new(mock_reporter.Mock_Reporter), mock_time) + executorObject := New(capabilities, new(mock_reporter.Mock_Reporter), mock_time) executionId, _ := uuid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") playbookId := "playbook--d09351a2-a075-40c8-8054-0b7c423db83f" stepId := "step--81eff59f-d084-4324-9e0a-59e353dbd28f" @@ -218,7 +218,7 @@ func TestNonExistingCapabilityStep(t *testing.T) { target: expectedTarget, variables: cacao.NewVariables(expectedVariables), agent: agent} - _, err := executerObject.executeCommands(metadata, + _, err := executorObject.executeCommands(metadata, data) assert.Equal(t, err, errors.New("capability: non-existing is not available in soarca")) @@ -232,7 +232,7 @@ func TestVariableInterpolation(t *testing.T) { capabilities := map[string]capability.ICapability{"cap1": mock_capability1} - executerObject := New(capabilities, new(mock_reporter.Mock_Reporter), mock_time) + executorObject := New(capabilities, new(mock_reporter.Mock_Reporter), mock_time) executionId, _ := uuid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") playbookId := "playbook--d09351a2-a075-40c8-8054-0b7c423db83f" stepId := "step--81eff59f-d084-4324-9e0a-59e353dbd28f" @@ -383,7 +383,7 @@ func TestVariableInterpolation(t *testing.T) { variables: cacao.NewVariables(var1, var2, var3, varUser, varPassword, varOauth, varPrivateKey, varToken, varUserId, varheader1, varheader2), agent: agent} - _, err := executerObject.executeCommands(metadata, + _, err := executorObject.executeCommands(metadata, data1) assert.Equal(t, err, nil) @@ -424,7 +424,7 @@ func TestVariableInterpolation(t *testing.T) { variables: cacao.NewVariables(varHttpContent, varheader1, varheader2), agent: agent} - _, err = executerObject.executeCommands(metadata, + _, err = executorObject.executeCommands(metadata, data2) assert.Equal(t, err, nil) diff --git a/pkg/core/executors/condition/condition.go b/pkg/core/executors/condition/condition.go index d86703ab..cbae9470 100644 --- a/pkg/core/executors/condition/condition.go +++ b/pkg/core/executors/condition/condition.go @@ -26,7 +26,7 @@ func New(comparison comparison.IComparison, reporter: reporter, time: time} } -type IExecuter interface { +type IExecutor interface { Execute(metadata execution.Metadata, step cacao.Step, variables cacao.Variables) (string, bool, error) } diff --git a/pkg/core/executors/executors.go b/pkg/core/executors/executors.go index 4b9b0454..43e2f017 100644 --- a/pkg/core/executors/executors.go +++ b/pkg/core/executors/executors.go @@ -5,7 +5,7 @@ import ( "soarca/pkg/models/execution" ) -type IPlaybookExecuter interface { +type IPlaybookExecutor interface { Execute(execution.Metadata, cacao.Step, cacao.Variables) (cacao.Variables, error) @@ -16,7 +16,7 @@ type Context struct { Variables cacao.Variables } -type IConditionExecuter interface { +type IConditionExecutor interface { Execute(metadata execution.Metadata, stepContext Context) (string, bool, error) } diff --git a/pkg/core/executors/playbook_action/playbook_action_executor_test.go b/pkg/core/executors/playbook_action/playbook_action_executor_test.go index cf0c9398..3ac7e674 100644 --- a/pkg/core/executors/playbook_action/playbook_action_executor_test.go +++ b/pkg/core/executors/playbook_action/playbook_action_executor_test.go @@ -29,7 +29,7 @@ func TestExecutePlaybook(t *testing.T) { controller := new(mock_decomposer_controller.Mock_Controller) database := new(mock_database_controller.Mock_Controller) - executerObject := New(controller, database, mock_reporter, mock_time) + executorObject := New(controller, database, mock_reporter, mock_time) executionId, _ := uuid.Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") playbookId := "playbook--d09351a2-a075-40c8-8054-0b7c423db83f" stepId := "step--81eff59f-d084-4324-9e0a-59e353dbd28f" @@ -89,7 +89,7 @@ func TestExecutePlaybook(t *testing.T) { mockDecomposer.On("Execute", playbook2).Return(&details, nil) - results, err := executerObject.Execute(metadata, step, cacao.NewVariables(addedVariables)) + results, err := executorObject.Execute(metadata, step, cacao.NewVariables(addedVariables)) mockDecomposer.AssertExpectations(t) mock_reporter.AssertExpectations(t) diff --git a/test/unittest/mocks/mock_executor/condition/condition_executor.go b/test/unittest/mocks/mock_executor/condition/condition_executor.go index fbce9002..8a70b726 100644 --- a/test/unittest/mocks/mock_executor/condition/condition_executor.go +++ b/test/unittest/mocks/mock_executor/condition/condition_executor.go @@ -11,8 +11,8 @@ type Mock_Condition struct { mock.Mock } -func (executer *Mock_Condition) Execute(metadata execution.Metadata, +func (executor *Mock_Condition) Execute(metadata execution.Metadata, context executors.Context) (string, bool, error) { - args := executer.Called(metadata, context) + args := executor.Called(metadata, context) return args.String(0), args.Bool(1), args.Error(2) } diff --git a/test/unittest/mocks/mock_executor/mock_executor.go b/test/unittest/mocks/mock_executor/mock_executor.go index 37401555..959687af 100644 --- a/test/unittest/mocks/mock_executor/mock_executor.go +++ b/test/unittest/mocks/mock_executor/mock_executor.go @@ -12,10 +12,10 @@ type Mock_Action_Executor struct { mock.Mock } -func (executer *Mock_Action_Executor) Execute( +func (executor *Mock_Action_Executor) Execute( metadata execution.Metadata, details executors.PlaybookStepMetadata) (cacao.Variables, error) { - args := executer.Called(metadata, details) + args := executor.Called(metadata, details) return args.Get(0).(cacao.Variables), args.Error(1) } diff --git a/test/unittest/mocks/mock_executor/playbook_action/mock_playbook_action_executor.go b/test/unittest/mocks/mock_executor/playbook_action/mock_playbook_action_executor.go index 482eb5a2..10eb76ec 100644 --- a/test/unittest/mocks/mock_executor/playbook_action/mock_playbook_action_executor.go +++ b/test/unittest/mocks/mock_executor/playbook_action/mock_playbook_action_executor.go @@ -11,9 +11,9 @@ type Mock_PlaybookActionExecutor struct { mock.Mock } -func (executer *Mock_PlaybookActionExecutor) Execute(metadata execution.Metadata, +func (executor *Mock_PlaybookActionExecutor) Execute(metadata execution.Metadata, step cacao.Step, variables cacao.Variables) (cacao.Variables, error) { - args := executer.Called(metadata, step, variables) + args := executor.Called(metadata, step, variables) return args.Get(0).(cacao.Variables), args.Error(1) }