From 5e45aa07136e7490e5838b3b8f1ee5b9e91d9cfd Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Fri, 27 Nov 2026 02:18:26 -0500 Subject: [PATCH] netsec-scan: hold current-state tripwires on a seed tick instead of printing them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A seed tick's contract is 'stdout empty + one summary line'. PromQL rules run before the seed block and their findings were still printed, so a cold start on a cluster with an active drop-spike (or four new-port lines) was NOT silent and its cron delivery outcome was 'delivered', not 'suppressed' — i.e. the seed tick still looked like the alert storm it exists to prevent. Observed live at 07:17Z: drop-spike + 4x new-port were firing. They are now absorbed with no cooldown clock (last_alert='') so the first warm tick reports them: the silence costs one interval, never a 24 h STATE_COOLDOWN. --- netsec_scan/__main__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/netsec_scan/__main__.py b/netsec_scan/__main__.py index 46a9fd8..d930732 100644 --- a/netsec_scan/__main__.py +++ b/netsec_scan/__main__.py @@ -616,6 +616,23 @@ def main(argv: Optional[List[str]] = None) -> int: st, (http_end - http_window, http_end), args, args.verbose) findings.extend(http_findings) + held = 0 + if seeding and findings: + # A current-state tripwire is real, but a seed tick's contract is + # "stdout empty, one summary line" — printing here is what made a + # cold start indistinguishable from an alert storm. Record the + # fingerprints (nothing is forgotten) but leave a state rule *due*: + # no cooldown clock, so the first warm tick reports it instead of a + # 24 h STATE_COOLDOWN eating it. A seed spanning several ticks + # defers them by at most that many intervals. + for finding in findings: + fresh = absorb(st, finding.kind, finding.entity, finding.rule, + finding.severity) + if fresh and finding.kind == "state": + st["seen"][finding.fingerprint]["last_alert"] = "" + held = len(findings) + findings = [] + if baseline["archive"]: # Not a fault, and not news either: these tuples are inside the # window the next alert would quote. Say so once, loudly enough to