netsec-agent/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sirius DevOps ba1bef3814 netsec-scan: read flows-*.jsonl.gz so a cold start baselines the retained window, not the live file
The collector gzips on rotation, so FLOW_PATTERN 'flows-*.jsonl' saw 1 of 5
files (measured: 1/72 of the retained window). Archives are immutable, so each
is read once, whole, decrypted lazily and recorded in state['archives'].

- archives are bounded (ARCHIVE_MAX_SECONDS/BYTES/FILES, newest first) and
  flows are consumed in batches; a partial pass leaves state seeded=false and
  reports the unread files as pending, so the next tick continues instead of
  alerting from a window it has not examined
- the alert window comes from the coverage start in the consumed filenames
  (monotone), so 'no prior in ~Xh of observed flows' is now verifiable
- the seed absorbs every egress tuple in the window, not just findings (a
  web-port tuple never becomes one on its first tick); a warm state meeting
  archives for the first time absorbs them the same way
- a torn .gz keeps its readable prefix, is noted in state/seed.failed, and does
  not abort the tick; in-flight *.gz.tmp.* markers are never read
- report.json carries window_h/covered_since/seed; 12 new tests
2026-11-27 02:09:51 -05:00
..
fixtures netsec-scan: deterministic sensor (6 PromQL tripwires + 2 flow-store novelty rules) 2026-11-27 00:20:46 -05:00
helpers.py netsec-scan: deterministic sensor (6 PromQL tripwires + 2 flow-store novelty rules) 2026-11-27 00:20:46 -05:00
test_archives.py netsec-scan: read flows-*.jsonl.gz so a cold start baselines the retained window, not the live file 2026-11-27 02:09:51 -05:00
test_flows.py netsec-scan: deterministic sensor (6 PromQL tripwires + 2 flow-store novelty rules) 2026-11-27 00:20:46 -05:00
test_rules.py netsec-scan: three-tick web-port gate (2 still leaked ~2 lines per CI build) 2026-11-27 00:41:41 -05:00
test_state.py netsec-scan: honest observation window, /dropped tuples, report baseline counts 2026-11-27 00:24:22 -05:00