Improve create alerts input (#493)
* check decisions start_ip & end_ip fields
This commit is contained in:
parent
a16fb1475d
commit
71325d9134
1 changed files with 6 additions and 0 deletions
|
@ -121,6 +121,12 @@ func (c *Controller) CreateAlert(gctx *gin.Context) {
|
|||
for _, alert := range input {
|
||||
if len(alert.Decisions) > 0 {
|
||||
log.Debugf("alert %s already has decisions, don't apply profiles", *alert.Message)
|
||||
for _, decision := range alert.Decisions {
|
||||
if decision.EndIP != 0 && decision.StartIP != 0 && decision.EndIP < decision.StartIP {
|
||||
gctx.JSON(http.StatusBadRequest, gin.H{"message": "'start_ip' must be lower than or equal to 'end_ip' in decisions"})
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
decisions, err := csprofiles.EvaluateProfiles(c.Profiles, alert)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue