Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

style(replay): satisfy ruff 0.4.x lint + format (UP038, import sort, line wrap)

Beenu Arorac2b07ff33caf
diff --git a/services/api/app/api/v1/endpoints/replay.py b/services/api/app/api/v1/endpoints/replay.py
index df9f352e6..ed4cda9a9 100644
--- a/services/api/app/api/v1/endpoints/replay.py
+++ b/services/api/app/api/v1/endpoints/replay.py
@@ -110,10 +110,7 @@ async def _load_run_and_events(
events = list(
(
await db.execute(
- select(InvestigationEvent)
- .where(InvestigationEvent.run_id == run_id)
- .order_by(InvestigationEvent.seq.asc())
- .limit(10000)
+ select(InvestigationEvent).where(InvestigationEvent.run_id == run_id).order_by(InvestigationEvent.seq.asc()).limit(10000)
)
)
.scalars()
@@ -277,9 +274,7 @@ async def get_public_replay(slug: str, db: DBSession) -> PublicReplay:
# Best-effort view bump; never fail the read on a counter error.
try:
- await db.execute(
- update(PublishedReplay).where(PublishedReplay.id == row.id).values(view_count=PublishedReplay.view_count + 1)
- )
+ await db.execute(update(PublishedReplay).where(PublishedReplay.id == row.id).values(view_count=PublishedReplay.view_count + 1))
await db.commit()
except Exception: # pragma: no cover - counter is best-effort only
await db.rollback()
diff --git a/services/api/app/services/replay_redaction.py b/services/api/app/services/replay_redaction.py
index 909e415de..3e15a2dd6 100644
--- a/services/api/app/services/replay_redaction.py
+++ b/services/api/app/services/replay_redaction.py
@@ -58,7 +58,7 @@ def _collect_techniques(raw_alert: dict | None, events: list[dict]) -> list[str]
def add(values: Any) -> None:
if isinstance(values, str):
values = [values]
- if isinstance(values, (list, tuple)):
+ if isinstance(values, list | tuple):
for v in values:
tid = str(v).upper().strip()
if tid and tid.startswith("T") and tid not in seen:
diff --git a/services/api/tests/test_replay_publish.py b/services/api/tests/test_replay_publish.py
index 556e1da47..efe56801f 100644
--- a/services/api/tests/test_replay_publish.py
+++ b/services/api/tests/test_replay_publish.py
@@ -10,7 +10,6 @@ from __future__ import annotations
from datetime import UTC, datetime, timedelta
import pytest
-
from app.services.replay_redaction import build_redacted_snapshot