From 42db90d904ac0a4a39f741f61ac2f4627bab5831 Mon Sep 17 00:00:00 2001 From: sabban <15465465+sabban@users.noreply.github.com> Date: Wed, 12 Oct 2022 15:57:08 +0200 Subject: [PATCH] fix issue https://github.com/crowdsecurity/crowdsec/issues/1627 --- pkg/leakybucket/overflows.go | 1 + pkg/models/alert.go | 2 +- pkg/models/localapi_swagger.yaml | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/leakybucket/overflows.go b/pkg/leakybucket/overflows.go index 3a7732aa6..1fec51945 100644 --- a/pkg/leakybucket/overflows.go +++ b/pkg/leakybucket/overflows.go @@ -265,6 +265,7 @@ func NewAlert(leaky *Leaky, queue *Queue) (types.RuntimeAlert, error) { StartAt: &startAt, StopAt: &stopAt, Simulated: &leaky.Simulated, + Labels: leaky.BucketConfig.Labels, } if leaky.BucketConfig == nil { return runtimeAlert, fmt.Errorf("leaky.BucketConfig is nil") diff --git a/pkg/models/alert.go b/pkg/models/alert.go index 3d20fa603..849386154 100644 --- a/pkg/models/alert.go +++ b/pkg/models/alert.go @@ -44,7 +44,7 @@ type Alert struct { ID int64 `json:"id,omitempty"` // labels - Labels []string `json:"labels"` + Labels map[string]string `json:"labels,omitempty"` // leakspeed // Required: true diff --git a/pkg/models/localapi_swagger.yaml b/pkg/models/localapi_swagger.yaml index 1849454dc..ff7aef395 100644 --- a/pkg/models/localapi_swagger.yaml +++ b/pkg/models/localapi_swagger.yaml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.0/schema.yaml swagger: '2.0' info: version: 1.0.0 @@ -748,8 +749,8 @@ definitions: meta: $ref: '#/definitions/Meta' labels: - type: array - items: + type: object + additionalProperties: type: string required: - scenario