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 {
0 commit comments