fix: use lowercase JSON keys matching CrowdSec's real alert schema
🚀 Docker Build and Push / build-and-push (push) Successful in 4m25s

CrowdSec's notification-http plugin serializes alerts with lowercase
keys (source/ip/cn/scenario), not the PascalCase (Source/IP/Cn/Scenario)
this code was reading. Every lookup silently fell through to its
default value, so every notification showed 'unknown' regardless of
the real IP, country or scenario. Confirmed by capturing a real payload.
This commit is contained in:
maxime.killinger committed 2026-08-29 13:54:33 +02:00
1 parent 81e32058af
commit 0337eb3071
1 file changed
+3 -3
+3 -3
View File
@@ -72,9 +72,9 @@ def handle_crowdsec():
# Group by IP
ip_groups = {}
for alert in alerts:
ip = alert.get("Source", {}).get("IP", "unknown")
country = alert.get("Source", {}).get("Cn", "")
scenario = alert.get("Scenario", "unknown")
ip = alert.get("source", {}).get("ip", "unknown")
country = alert.get("source", {}).get("cn", "")
scenario = alert.get("scenario", "unknown")
if ip not in ip_groups:
ip_groups[ip] = {"country": country, "scenarios": set()}