Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(security): fully clear shodan.go log-injection + clear-text-logging (#444)
Beenu Aroraddf14e30fc1a
diff --git a/services/ingest/internal/enrichment/shodan.go b/services/ingest/internal/enrichment/shodan.goindex 7fcb37300..47b1d9e8f 100644--- a/services/ingest/internal/enrichment/shodan.go+++ b/services/ingest/internal/enrichment/shodan.go@@ -78,11 +78,12 @@ func (s *ShodanEnricher) Enrich(ctx context.Context, event map[string]interface{host, err := s.lookup(ctx, ip)if err != nil {- // Log a sanitized IP only. `ip` is derived from an ingested (attacker-- // influenceable) event, so strip control chars to prevent log- // injection; and we deliberately do NOT log `err`, which can carry the- // request URL (with the Shodan API key) or response-derived data.- s.log.Warn("Shodan lookup failed", "ip", sanitizeLogValue(ip))+ // Best-effort enrichment: a lookup failure is non-fatal (the event+ // flows through unmodified). Log a static message with no fields —+ // neither the raw `err` (which can carry the request URL with the+ // Shodan API key or response-derived data) nor the event-derived `ip`+ // (attacker-influenceable + PII) reaches the log.+ s.log.Warn("Shodan host lookup failed; enrichment skipped")return event}if host == nil {@@ -191,19 +192,3 @@ func ExtractPublicIP(event map[string]interface{}) string {}return ""}--// sanitizeLogValue strips CR/LF and other control characters so a value-// derived from an ingested (attacker-influenceable) event cannot forge or-// inject additional log lines.-func sanitizeLogValue(s string) string {- cleaned := strings.Map(func(r rune) rune {- if r < 0x20 || r == 0x7f {- return -1- }- return r- }, s)- if len(cleaned) > 256 {- return cleaned[:256]- }- return cleaned-}