Phase 5: deterministic detection rules and time-window correlation #6
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/deterministic-analysis"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What does this PR do?
Implements the Phase 5 first increment: deterministic detection rules and time-window correlation, turning individual normalized events into scored, correlated incidents. No LLM involvement anywhere in this path.
src/Viegard.Application/Detection/):IDetectionRuleport; HTTP rules (sensitive-path probing, path traversal incl. encoded variants, SQL-injection/command-injection/XSS indicators, suspicious User-Agents, unusual methods, error-status supporting evidence) and conservative mail rules (link count, from/link domain mismatch, reply-to mismatch, double/executable attachment extensions). All term lists and scores configurable viaViegard:Detectionwith working code defaults. Hostile input is matched with linearContains/IndexOfscans only: no regex on untrusted data, so catastrophic backtracking is impossible by construction.TimeWindowCorrelator): folds scored events into incidents keyed by source IP (ip=<value>) or mail sender, with a configurable window (default 10 min), window extension on continued activity, context-event appending, and caps on member events/evidence with explicit truncation markers. Benign traffic never creates incidents.CorrelationWorker: consumes the durable events queue (lease/complete/abandon; poison handling stays in the queue), gated on thecorrelationrole (D-0011), audited atPipelineStage.Correlation.Fixes #
How was this tested?
dotnet build Viegard.slnx- 0 errors, 0 warningsdotnet test Viegard.slnx- 163/163 pass including the 17 live PostgreSQL integration tests (disposable postgres:17 container; schema reset before run)Correlation worker startedImplementation was drafted by a coding agent against a detailed spec, then independently reviewed (diff + security spot-check on untrusted-input matching) and re-verified by a second full test run.
Checklist