feat(intel): persist per-provider taxonomy on AttackerIntel for TTP dispatch
The 2026-05-02 ship-time audit of the R0054-R0058 intel rule pack found that AbuseIPDB / GreyNoise / ThreatFox stored only the aggregate verdict (score / classification / listed-bool) plus the raw response blob. The TTP IntelLifter expects per-provider taxonomy fields (categories, tags, threat_types) that were never populated, so R0054 / R0055 / R0057 emitted zero tags in production despite passing unit tests. Add typed columns: abuseipdb_categories, greynoise_tags, greynoise_name, feodo_malware_family, threatfox_threat_types, threatfox_ioc_types, threatfox_malware_families. Each provider now parses the relevant taxonomy out of the upstream response and writes it through column_updates. JSON-list columns ride as TEXT with default "[]" to keep the SQLite/MySQL backend split honest, deserialised back to native lists by the repo on read.
This commit is contained in:
@@ -87,6 +87,31 @@ async def test_unlisted_ip_returns_no_verdict():
|
||||
assert result.column_updates["feodo_listed"] is False
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_listed_ip_persists_malware_family():
|
||||
"""Post-2026-05-02 audit: IntelLifter reads
|
||||
``feodo_malware_family`` for evidence; persist it as a typed
|
||||
column rather than only inside ``feodo_raw``."""
|
||||
async def handler(request: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(200, json=_FEED)
|
||||
|
||||
_install_transport(handler)
|
||||
provider = FeodoProvider(refresh_interval_s=999.0)
|
||||
result = await provider.lookup("9.9.9.9")
|
||||
assert result.column_updates["feodo_malware_family"] == "TrickBot"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_unlisted_ip_clears_family():
|
||||
async def handler(request: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(200, json=_FEED)
|
||||
|
||||
_install_transport(handler)
|
||||
provider = FeodoProvider(refresh_interval_s=999.0)
|
||||
result = await provider.lookup("1.2.3.4")
|
||||
assert result.column_updates["feodo_malware_family"] is None
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_feed_failure_reports_error():
|
||||
async def handler(request: httpx.Request) -> httpx.Response:
|
||||
|
||||
Reference in New Issue
Block a user