Skip to content

Commit

Permalink
Loads of detection fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Sep 10, 2024
1 parent 72f465c commit e78d1eb
Show file tree
Hide file tree
Showing 5 changed files with 406 additions and 153 deletions.
20 changes: 15 additions & 5 deletions blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@ package shuffle
func GetPublicDetections() []DetectionResponse {
return []DetectionResponse{
DetectionResponse{
Title: "Sigma SIEM Detections",
Title: "Sigma SIEM Detections",
DetectionName: "Sigma",
Category: "SIEM",
DetectionInfo: []DetectionFileInfo{},
FolderDisabled: false,
IsConnectorActive: false,
DownloadRepo: "https://github.com/satti-hari-krishna-reddy/shuffle_sigma",
DownloadRepo: "https://github.com/shuffle/security-rules",
},
DetectionResponse{
Title: "Sublime Email Detection",
Title: "Sublime Email Detection",
DetectionName: "Sublime",
Category: "Email",
DetectionInfo: []DetectionFileInfo{},
FolderDisabled: false,
IsConnectorActive: false,
DownloadRepo: "https://github.com/shuffle/security-rules",
},
DetectionResponse{
Title: "File Detection",
DetectionName: "Yara",
Category: "Files",
DetectionInfo: []DetectionFileInfo{},
FolderDisabled: false,
IsConnectorActive: false,
DownloadRepo: "https://github.com/shuffle/security-rules",
},
}
}
Expand Down Expand Up @@ -312,14 +322,14 @@ func GetUsecaseData() string {
},
{
"name": "ChatOps",
"priority": 70,
"priority": 60,
"type": "communication",
"last": "cases",
"items": {}
},
{
"name": "Threat Intel received",
"priority": 50,
"priority": 20,
"type": "intel",
"last": "cases",
"items": {}
Expand Down
37 changes: 36 additions & 1 deletion db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -3060,7 +3060,6 @@ func GetWorkflow(ctx context.Context, id string) (*Workflow, error) {

newWorkflow := FixWorkflowPosition(ctx, *workflow)
workflow = &newWorkflow

if project.CacheDb && workflow.ID != "" {
//log.Printf("[DEBUG] Setting cache for workflow %s", cacheKey)
data, err := json.Marshal(workflow)
Expand Down Expand Up @@ -7904,7 +7903,14 @@ func FixWorkflowPosition(ctx context.Context, workflow Workflow) Workflow {
}

// Fix branches & triggers
scheduleNotStarted := ""
for index, trigger := range workflow.Triggers {
if trigger.TriggerType == "SCHEDULE" {
if trigger.Status != "RUNNING" {
scheduleNotStarted = trigger.ID
}
}

if trigger.ID == "" {
workflow.Triggers[index].ID = uuid.NewV4().String()
}
Expand All @@ -7916,6 +7922,35 @@ func FixWorkflowPosition(ctx context.Context, workflow Workflow) Workflow {
}
}

// Check validation if Schedule is started (?)
if len(scheduleNotStarted) > 0 {
// Add validation problem
found := false
for _, problem := range workflow.Validation.Errors {
if problem.Type == "SCHEDULE" {
found = true
break
}
}

if !found {
workflow.Validation.Errors = append(workflow.Validation.Errors, ValidationProblem{
Order: -1,
Type: "SCHEDULE",
ActionId: scheduleNotStarted,
Error: "Schedule not started",
})
}
}

if len(workflow.Validation.Errors) == 0 {
workflow.Validation.Errors = []ValidationProblem{}
}

if len(workflow.Validation.SubflowApps) == 0 {
workflow.Validation.SubflowApps = []ValidationProblem{}
}

return workflow
}

Expand Down
Loading

0 comments on commit e78d1eb

Please sign in to comment.