Skip to content

Commit

Permalink
fix the reload process for appsec (#2750)
Browse files Browse the repository at this point in the history
  • Loading branch information
buixor committed Jan 17, 2024
1 parent f156f17 commit 685cda5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/acquisition/modules/appsec/appsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ func (w *AppsecSource) StreamingAcquisition(out chan types.Event, t *tomb.Tomb)
})
<-t.Dying()
w.logger.Infof("Stopping Appsec server on %s%s", w.config.ListenAddr, w.config.Path)
//xx let's clean up the appsec runners :)
appsec.AppsecRulesDetails = make(map[int]appsec.RulesDetails)
w.server.Shutdown(context.TODO())
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/appsec/appsec_rules_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type RulesDetails struct {
Name string
}

// Should it be a global ?
// FIXME: this shouldn't be a global
// Is using the id is a good idea ? might be too specific to coraza and not easily reusable
var AppsecRulesDetails = make(map[int]RulesDetails)

Expand Down
1 change: 1 addition & 0 deletions pkg/appsec/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var hub *cwhub.Hub //FIXME: this is a temporary hack to make the hub available i
func LoadAppsecRules(hubInstance *cwhub.Hub) error {

hub = hubInstance
appsecRules = make(map[string]AppsecCollectionConfig)

for _, hubAppsecRuleItem := range hub.GetItemMap(cwhub.APPSEC_RULES) {
if !hubAppsecRuleItem.State.Installed {
Expand Down

0 comments on commit 685cda5

Please sign in to comment.