Add host correlation and assurance coverage
This commit is contained in:
parent
8194d13734
commit
b40ac4252c
36 changed files with 944 additions and 23 deletions
|
|
@ -118,6 +118,7 @@ def load_index(cfg: Config) -> dict:
|
|||
for inc in data.values():
|
||||
if isinstance(inc, dict):
|
||||
inc.setdefault("schema", schemas.INCIDENT_V1)
|
||||
inc.setdefault("correlations", [])
|
||||
return data
|
||||
except (OSError, ValueError):
|
||||
return {}
|
||||
|
|
@ -174,6 +175,7 @@ def record(cfg: Config, snapshot_name: str, alerts: list[Alert],
|
|||
"severity": severity,
|
||||
"signatures": [], "sids": [], "pids": [],
|
||||
"lineage": [], "snapshots": [], "alert_count": 0,
|
||||
"correlations": [],
|
||||
}
|
||||
inc = index[iid]
|
||||
inc.setdefault("schema", schemas.INCIDENT_V1)
|
||||
|
|
@ -186,6 +188,16 @@ def record(cfg: Config, snapshot_name: str, alerts: list[Alert],
|
|||
inc["lineage"] = sorted(set(inc["lineage"]) | lineage)
|
||||
inc["snapshots"].append(snapshot_name)
|
||||
inc["alert_count"] += len(alerts)
|
||||
from . import correlation
|
||||
inc["correlations"] = correlation.correlate(inc)
|
||||
for corr in inc["correlations"]:
|
||||
if corr["sid"] not in inc["sids"]:
|
||||
inc["sids"].append(corr["sid"])
|
||||
inc["severity"] = max_severity(
|
||||
inc.get("severity", severity),
|
||||
max((c.get("severity", severity) for c in inc["correlations"]),
|
||||
default=severity),
|
||||
)
|
||||
save_index(cfg, index)
|
||||
return iid
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue