Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the reload process for appsec #2750

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@
})
<-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)

Check warning on line 272 in pkg/acquisition/modules/appsec/appsec.go

View check run for this annotation

Codecov / codecov/patch

pkg/acquisition/modules/appsec/appsec.go#L271-L272

Added lines #L271 - L272 were not covered by tests
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