netsec-scan: honest observation window, /dropped tuples, report baseline counts
- first-seen egress is gated by the cumulative seen-set only (deleting a fingerprint re-arms the rule); the alert states the observed window (~20m / 3.2h / 2.1d) instead of implying the collector holds weeks. - a DROPPED attempt on a new to-world tuple is keyed separately from forwarded traffic to the same destination and graded HIGH. - daily report counts every external tuple seen that day, not just novel ones. - drop-prune of the dead state['egress'] map; tests cover the single-fire rearm, day counters and the egress union. - README: measured collector volume/tombstones/partial-tail behaviour, scheduler shim path.
This commit is contained in:
parent
68b2616cc5
commit
c31d46a037
6 changed files with 174 additions and 52 deletions
|
|
@ -45,13 +45,13 @@ class TestStateFile(unittest.TestCase):
|
|||
|
||||
def test_missing_key_is_added_not_replaced(self):
|
||||
st = state_mod.load(self.path)
|
||||
st["egress"]["a->1.2.3.4:443/tcp"] = "2026-11-27T00:00:00+00:00"
|
||||
st["seen"]["aaaa"] = {"rule": "x", "first": "2026-11-27T00:00:00+00:00"}
|
||||
state_mod.save(self.path, st)
|
||||
again = state_mod.load(self.path)
|
||||
again["egress"]["b->5.6.7.8:80/tcp"] = "2026-11-27T00:01:00+00:00"
|
||||
again["seen"]["bbbb"] = {"rule": "x", "first": "2026-11-27T00:01:00+00:00"}
|
||||
state_mod.save(self.path, again)
|
||||
final = json.loads(self.path.read_text())
|
||||
self.assertEqual(len(final["egress"]), 2)
|
||||
self.assertEqual(sorted(final["seen"]), ["aaaa", "bbbb"])
|
||||
|
||||
def test_prune_bounds_the_seen_set(self):
|
||||
st = state_mod.load(self.path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue