Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
buixor committed Oct 30, 2024
1 parent ed00b70 commit 37c0447
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/alertcontext/alertcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ func EvalAlertContextRules(evt *types.Event, match *types.MatchedRule, request *
//if we're evaluating context for appsec event, match and request will be present.
//otherwise, only evt will be.
if evt == nil {
evt = types.EmptyEvent()
evt = types.NewEvent()
}
if match == nil {
match = types.EmptyMatchedRule()
match = types.NewMatchedRule()
}
if request == nil {
request = &http.Request{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/appsec_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const (
Kind Field = "kind"
)

func EmptyMatchedRule() *MatchedRule {
func NewMatchedRule() *MatchedRule {
return &MatchedRule{}
}

Expand Down
10 changes: 6 additions & 4 deletions pkg/types/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ type Event struct {
Meta map[string]string `yaml:"Meta,omitempty" json:"Meta,omitempty"`
}

func EmptyEvent() *Event {
func NewEvent() *Event {
return &Event{Type: LOG,
Parsed: make(map[string]string),
Enriched: make(map[string]string),
Meta: make(map[string]string)}
Parsed: make(map[string]string),
Enriched: make(map[string]string),
Meta: make(map[string]string),
Unmarshaled: make(map[string]interface{}),
}
}

func (e *Event) SetMeta(key string, value string) bool {
Expand Down

0 comments on commit 37c0447

Please sign in to comment.