-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Configurable detection thresholds #47
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -91,6 +91,15 @@ func New(cfg *config.Config, configPath string) *Server { | |||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||
| log.Printf("Warning: Failed to initialize security manager: %v", err) | ||||||||||||||||||||||
| } else { | ||||||||||||||||||||||
| // Apply detection thresholds from config | ||||||||||||||||||||||
| securityManager.SetDetectorThresholds( | ||||||||||||||||||||||
| cfg.Security.RateThreshold, | ||||||||||||||||||||||
| cfg.Security.NotFoundThreshold, | ||||||||||||||||||||||
| cfg.Security.AuthFailureThreshold, | ||||||||||||||||||||||
| cfg.Security.UniquePathsThreshold, | ||||||||||||||||||||||
| cfg.Security.RepeatedHitsThreshold, | ||||||||||||||||||||||
| cfg.Security.DetectionWindow, | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
Comment on lines
+95
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||
| nginxConfigPath := cfg.Nginx.ConfigPath | ||||||||||||||||||||||
| if nginxConfigPath == "" { | ||||||||||||||||||||||
| nginxConfigPath = filepath.Join(cfg.DeploymentsPath, "nginx", "conf.d") | ||||||||||||||||||||||
|
|
@@ -293,6 +302,9 @@ func (s *Server) setupRoutes() { | |||||||||||||||||||||
| // Ingest endpoints (no auth - called by nginx Lua) | ||||||||||||||||||||||
| api.POST("/security/events/ingest", s.ingestSecurityEvent) | ||||||||||||||||||||||
| api.POST("/traffic/ingest", s.ingestTrafficLog) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Internal nginx endpoint - token-authenticated for blocked IPs | ||||||||||||||||||||||
| api.GET("/_internal/blocked-ips", s.listBlockedIPsInternal) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistent with previous duration parsing suggestions, explicitly handle errors for
DetectionWindowto provide clear feedback to the API consumer.