15 Commits

Author SHA1 Message Date
drev74
cf7c995137 fix: add trie instantiation on top
test(it): add blacklisting test with real data
2025-10-19 22:32:58 +03:00
fabriziosalmi
1c32e928f1 refactor: enhance IP blacklist handling and add panic recovery in middleware 2025-10-16 00:58:51 +02:00
drev74
c905277058 feat!!: switch to go-trie 2025-10-10 23:21:41 +03:00
fabriziosalmi
9223d337fc fixes for the following issues:
- https://github.com/fabriziosalmi/caddy-waf/issues/41
- https://github.com/fabriziosalmi/caddy-waf/issues/40
2025-01-29 13:34:27 +01:00
fabriziosalmi
86c96b9bac IP & DNS blacklists hits metrics adn tests added. 2025-01-26 14:01:13 +01:00
fabriziosalmi
afd81fc8d9 Minor improvements. 2025-01-24 21:29:50 +01:00
fabriziosalmi
f4bd92c5a0 Minor code improvements. 2025-01-22 13:12:26 +01:00
fabriziosalmi
78e491b5bf feat(waf): optimize rule processing and IP blacklist lookups
- Added short-circuit mechanism to stop rule evaluation early if a blocking decision is made.
- Replaced `map[string]struct{}` with `*CIDRTrie` for efficient IP blacklist storage and lookups.
- Improved performance by avoiding unnecessary rule evaluations and optimizing CIDR range checks.
- Updated `processRuleMatch`, `handlePhase`, and `loadIPBlacklistIntoMap` to support the new optimizations.
2025-01-18 23:15:44 +01:00
fabriziosalmi
2c175276bd logging improved to adhere to Caddy standards. 2025-01-15 16:54:14 +01:00
fabriziosalmi
2bc1b2d27d feat: add metrics collection and endpoint for WAF statistics
- Added metrics tracking for total, blocked, and allowed requests
- Implemented rule hit statistics by phase and rule ID
- Added GeoIP statistics for country-based request tracking
- Introduced a new metrics endpoint to expose collected data in JSON format
- Updated middleware to handle metrics requests and log statistics
2025-01-15 13:05:29 +01:00
fabriziosalmi
6ae8c31a91 Minor improvements 2025-01-15 11:44:51 +01:00
fabriziosalmi
8bcb6b7c57 Minor improvements 2025-01-15 11:12:25 +01:00
fabriziosalmi
71effd4d01 modularizing.. 2025-01-15 00:34:24 +01:00
fab
aab67e34fa Delete blacklist.go 2025-01-09 13:45:54 +01:00
fab
d02af90d20 Create blacklist.go
IP and DNS blacklisting logic moved
2025-01-09 12:21:03 +01:00