Skip to content

Commit 607b32c

Browse files
committed
Small changes to the auto generate workflow system
1 parent 8b6344f commit 607b32c

File tree

3 files changed

+28
-56
lines changed

3 files changed

+28
-56
lines changed

blobs.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ func GetDefaultWorkflowByType(workflow Workflow, orgId string, categoryAction Ca
134134
Description: "List tickets from different systems and ingest them",
135135
OrgId: orgId,
136136
Start: startActionId,
137+
UsecaseIds: []string{"SIEM to ticket"},
138+
Tags: []string{"ingest", "automatic"},
137139
Actions: []Action{
138140
Action{
139141
Name: actionName,
@@ -184,10 +186,12 @@ func GetDefaultWorkflowByType(workflow Workflow, orgId string, categoryAction Ca
184186
} else if parsedActiontype == "ingest_tickets_webhook" {
185187

186188
defaultWorkflow := Workflow{
187-
Name: actionType,
189+
Name: "Ingestion Webhook",
188190
Description: "Ingest tickets through a webhook",
189191
OrgId: orgId,
190192
Start: startActionId,
193+
UsecaseIds: []string{"SIEM to ticket"},
194+
Tags: []string{"ingest", "webhook", "automatic"},
191195
Actions: []Action{
192196
Action{
193197
Name: "Translate standard",
@@ -326,6 +330,8 @@ func GetDefaultWorkflowByType(workflow Workflow, orgId string, categoryAction Ca
326330
Description: "Monitor threatlists and ingest regularly",
327331
OrgId: orgId,
328332
Start: startActionId,
333+
UsecaseIds: []string{"External Enrichment"},
334+
Tags: []string{"ingest", "feeds", "automatic"},
329335
Actions: []Action{
330336
Action{
331337
Name: "GET",
@@ -1679,7 +1685,7 @@ func GetUsecaseData() string {
16791685
}
16801686
},
16811687
{
1682-
"name": "External historical Enrichment",
1688+
"name": "External Enrichment",
16831689
"priority": 90,
16841690
"type": "intel",
16851691
"items": {

codegen.go

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"compress/gzip"
99
"context"
1010
"crypto/md5"
11-
"crypto/sha1"
1211
"crypto/sha256"
1312
"encoding/json"
1413
"errors"
@@ -30,7 +29,6 @@ import (
3029
"cloud.google.com/go/storage"
3130
docker "github.com/docker/docker/client"
3231
"github.com/frikky/kin-openapi/openapi3"
33-
uuid "github.com/satori/go.uuid"
3432
"gopkg.in/yaml.v2"
3533
)
3634

@@ -4774,61 +4772,29 @@ func handleRunDatastoreAutomation(cacheData CacheKeyData, automation DatastoreAu
47744772
}
47754773

47764774
if parsedName == "correlate_categories" {
4777-
if debug {
4778-
}
4779-
4780-
// Ensure the standard correlation-workflow exists
4781-
seedString := fmt.Sprintf("%s_correlate_categories", cacheData.OrgId)
4782-
hash := sha1.New()
4783-
hash.Write([]byte(seedString))
4784-
hashBytes := hash.Sum(nil)
4785-
4786-
uuidBytes := make([]byte, 16)
4787-
copy(uuidBytes, hashBytes)
4788-
workflowId := uuid.Must(uuid.FromBytes(uuidBytes)).String()
4789-
4790-
workflow, err := GetWorkflow(ctx, workflowId)
4791-
if err != nil || workflow.ID == "" || workflow.Name == "" {
4792-
log.Printf("[ERROR] Failed to get correlation workflow by ID %s: %s", workflowId, err)
4793-
4794-
categoryAction := CategoryAction{
4795-
Label: "correlate_categories",
4796-
}
4797-
4798-
workflow.ID = workflowId
4799-
newWorkflow, err := GetDefaultWorkflowByType(*workflow, cacheData.OrgId, categoryAction)
4800-
if err != nil || newWorkflow.ID == "" || newWorkflow.Name == "" {
4801-
log.Printf("[ERROR] Failed to get default workflow by type %s: %s", categoryAction.Label, err)
4802-
return errors.New(fmt.Sprintf("Failed to get default workflow by type %s: %s", categoryAction, err))
4803-
}
4775+
// Correlations don't matter anymore as ngrams are automatic. Cleaned up
4776+
// november 2025 after adding graphic system to datastore
4777+
} else if parsedName == "enrich" {
4778+
log.Printf("Should enrich the following data: %s", string(marshalledBody))
48044779

4805-
workflow = &newWorkflow
4806-
workflow.ID = workflowId
4780+
// Use key "enrichments" =>
4781+
// [{"name": "answers.ip", "value": "92.24.47.250", "type": "location", "data": {"city": "Socotra", "continent": "Asia", "coordinates": [-25.4153, 17.0743], "country": "YE", "desc": "Yemen"}}]
48074782

4808-
SetWorkflow(ctx, *workflow, workflowId)
4809-
}
4783+
// Send the data into shuffle_tools => parse_ioc?
4784+
// Or generate a subflow that runs for it? :thinking:
48104785

4811-
for _, option := range automation.Options {
4812-
if option.Key != "datastore_categories" {
4813-
continue
4814-
}
4786+
// Example process:
4787+
// 1. Ingest IOC (hash/IP/domain/alert) => inject into datastore category
4788+
// 2. Query reputation + passive DNS + WHOIS + SSL CT.
4789+
// 3. Run lookup in historic sightings (SIEM, MISP).
4790+
// 4. If file hash: submit to sandbox + static YARA.
4791+
// 5. Map results to ATT&CK techniques and assign a risk score.
4792+
// 6. Push enriched alert to SIEM/EDR/SOAR for automated playbook or analyst triage.
4793+
// 7. If high confidence, add to blocklists / trigger containment / share via STIX/TAXII or MISP.
48154794

4816-
if len(option.Value) == 0 {
4817-
continue
4818-
}
48194795

4820-
log.Printf("[DEBUG] Found datastore categories to correlate: %s. Workflow to run: %s", option.Value, workflow.ID)
4821-
4822-
//func handleDatastoreAutomationWebhook(ctx context.Context, marshalledBody []byte, cacheData CacheKeyData, automation DatastoreAutomation, url, runType string) error {
4823-
go handleDatastoreAutomationWebhook(
4824-
ctx,
4825-
marshalledBody,
4826-
cacheData,
4827-
automation,
4828-
fmt.Sprintf("/api/v1/workflows/%s/execute", workflowId),
4829-
"run_workflow",
4830-
)
4831-
}
4796+
// Getting started:
4797+
// 1. Check for enrichments key. Stop if it exists.
48324798

48334799
} else if parsedName == "run_workflow" {
48344800
if debug {

db-connector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13475,7 +13475,7 @@ func SetDatastoreKeyBulk(ctx context.Context, allKeys []CacheKeyData) ([]Datasto
1347513475
}
1347613476

1347713477
// Run the automation
13478-
// This should prolly make a notification if it fails
13478+
// This should make a notification if it fails
1347913479
go func(cacheData CacheKeyData, automation DatastoreAutomation) {
1348013480
err := handleRunDatastoreAutomation(cacheData, automation)
1348113481
if err != nil {
@@ -13689,7 +13689,7 @@ func SetDatastoreKey(ctx context.Context, cacheData CacheKeyData) error {
1368913689
}
1369013690

1369113691
// Run the automation
13692-
// This should prolly make a notification if it fails
13692+
// This should make a notification if it fails
1369313693
go func(cacheData CacheKeyData, automation DatastoreAutomation) {
1369413694
err := handleRunDatastoreAutomation(cacheData, automation)
1369513695
if err != nil {

0 commit comments

Comments
 (0)