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.

fix(gate): the two AI-estate checkers resolve their root through git

Beenu Arora0b2d9cf56e1e
diff --git a/scripts/check_ai_asset_inventory.py b/scripts/check_ai_asset_inventory.py
index a96cabd70..07de154a4 100644
--- a/scripts/check_ai_asset_inventory.py
+++ b/scripts/check_ai_asset_inventory.py
@@ -50,7 +50,17 @@ import sys
import tempfile
from pathlib import Path
-REPO_ROOT = Path(__file__).resolve().parent.parent
+# `scripts/` is on sys.path when this file runs as a program, but not when a
+# test loads it by path with importlib. gate_toolkit sits beside it either way.
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+
+from gate_toolkit import repo_root # noqa: E402
+
+# Resolved through `git rev-parse`, not from `__file__`. Two levels above this
+# script is whatever happens to be there -- `scripts/` copied into an empty
+# repository is exactly that, and a gate that reads it reports a tree clean
+# without ever seeing the product. `check_gate_contract.py` refuses it.
+REPO_ROOT = repo_root()
#: The table the whole item hangs on.
TABLE = "aisoc_ai_assets"
diff --git a/scripts/check_ai_endpoint_discovery.py b/scripts/check_ai_endpoint_discovery.py
index 260df2807..4a8be3226 100644
--- a/scripts/check_ai_endpoint_discovery.py
+++ b/scripts/check_ai_endpoint_discovery.py
@@ -46,7 +46,17 @@ import sys
import tempfile
from pathlib import Path
-REPO_ROOT = Path(__file__).resolve().parent.parent
+# `scripts/` is on sys.path when this file runs as a program, but not when a
+# test loads it by path with importlib. gate_toolkit sits beside it either way.
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+
+from gate_toolkit import repo_root # noqa: E402
+
+# Resolved through `git rev-parse`, not from `__file__`. Two levels above this
+# script is whatever happens to be there -- `scripts/` copied into an empty
+# repository is exactly that, and a gate that reads it reports a tree clean
+# without ever seeing the product. `check_gate_contract.py` refuses it.
+REPO_ROOT = repo_root()
RECORDER_PATH = Path("services/fusion/app/services/ai_asset_recorder.py")
PACK_PATH = Path("packs/aisoc-ai-estate.yaml")