Skip to content

Commit

Permalink
Merge pull request #535 from Security-Onion-Solutions/cogburn/fix-build
Browse files Browse the repository at this point in the history
Only disallow bulk action w/community rules on Delete
  • Loading branch information
coreyogburn authored Jun 4, 2024
2 parents fe95817 + 259ebe5 commit 95dc1c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sensoroni
jobs/
logs/
nsm/
coverage/
.vscode/
.DS_Store

Expand Down
22 changes: 12 additions & 10 deletions server/detectionhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,20 +420,22 @@ func (h *DetectionHandler) bulkUpdateDetection(w http.ResponseWriter, r *http.Re
} else {
for _, id := range body.IDs {
IDs = append(IDs, id)
det, err := h.server.Detectionstore.GetDetection(ctx, id)
if err != nil {
web.Respond(w, r, http.StatusInternalServerError, err)
return
}

if det.IsCommunity {
containsCommunity = true
break
if body.Delete {
det, err := h.server.Detectionstore.GetDetection(ctx, id)
if err != nil {
web.Respond(w, r, http.StatusInternalServerError, err)
return
}

if det.IsCommunity {
containsCommunity = true
break
}
}
}
}

if containsCommunity {
if containsCommunity && body.Delete {
web.Respond(w, r, http.StatusBadRequest, "ERROR_BULK_COMMUNITY")
return
}
Expand Down
10 changes: 0 additions & 10 deletions server/modules/elastalert/elastalert.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,16 +1006,6 @@ func (e *ElastAlertEngine) syncCommunityDetections(ctx context.Context, detects
}
}

// carry forward existing overrides
for i := range detects {
det := detects[i]

comDet, exists := community[det.PublicID]
if exists {
det.Overrides = comDet.Overrides
}
}

results := struct {
Added int
Updated int
Expand Down

0 comments on commit 95dc1c4

Please sign in to comment.