feat(ttp): implement E.3.14b intel catch-up via attacker.session.ended
On every attacker.session.ended event, the TTP worker now reads the persisted AttackerIntel row (if any) and synthesizes an intel-source TaggerEvent so intel-derived tags emit even when attacker.intel.enriched was dropped or arrived before the worker started. Key changes: - AttackerIntel.to_intel_event_payload() — single source of truth for the intel-row → lifter payload projection; shared by future callers without importing decnet.intel.* (no-SPOF contract preserved). - BaseRepository.get_attacker_intel_row_by_uuid() — returns the live SQLModel instance so the catch-up path can call to_intel_event_payload(). - _build_intel_catchup_event() in ttp/worker.py — looks up the intel row, builds the TaggerEvent, returns None on absent row (silence, not error). - _process_event() extended: appends the catch-up event to tagger_events when topic contains "session.ended". Deterministic source_id keeps compute_tag_uuid idempotent across replays; INSERT OR IGNORE deduplicates against any prior attacker.intel.enriched path. DummyRepo stub + coverage call added per feedback_run_base_repo_test.md.
This commit is contained in:
@@ -78,6 +78,7 @@ class DummyRepo(BaseRepository):
|
||||
# DEBT-041 / 3eb67c9 — attacker_intel re-key
|
||||
async def find_credential_reuse_candidates(self, min_targets=2): await super().find_credential_reuse_candidates(min_targets); return []
|
||||
async def get_attacker_intel_by_uuid(self, u): await super().get_attacker_intel_by_uuid(u)
|
||||
async def get_attacker_intel_row_by_uuid(self, u): await super().get_attacker_intel_row_by_uuid(u)
|
||||
async def get_unenriched_attackers(self, limit=100): await super().get_unenriched_attackers(limit)
|
||||
async def upsert_attacker_intel(self, d): await super().upsert_attacker_intel(d); return ""
|
||||
# Identity resolution (this PR)
|
||||
@@ -228,6 +229,7 @@ async def test_base_repo_coverage():
|
||||
await dr.get_session_log("a")
|
||||
await dr.find_credential_reuse_candidates()
|
||||
await dr.get_attacker_intel_by_uuid("a")
|
||||
await dr.get_attacker_intel_row_by_uuid("a")
|
||||
await dr.get_unenriched_attackers()
|
||||
await dr.upsert_attacker_intel({"attacker_uuid": "a", "attacker_ip": "1.1.1.1"})
|
||||
await dr.get_identity_by_uuid("a")
|
||||
|
||||
Reference in New Issue
Block a user