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.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(api): attach service credentials to agents-service proxies
Alexandru Mateescu9b2e264f81ac
diff --git a/services/api/app/api/v1/endpoints/playbooks.py b/services/api/app/api/v1/endpoints/playbooks.pyindex c21fe1d32..8d1ecc17e 100644--- a/services/api/app/api/v1/endpoints/playbooks.py+++ b/services/api/app/api/v1/endpoints/playbooks.py@@ -32,6 +32,8 @@ from fastapi import APIRouter, Depends, HTTPException, Request, statusfrom app.api.v1.deps import AuthUser, require_permission_AGENTS_URL = os.getenv("AGENTS_SERVICE_URL") or os.getenv("AGENTS_API_URL", "http://agents:8084")+# See cases.py: the agents router fails closed without a bearer credential.+_AGENTS_SERVICE_TOKEN = (os.getenv("AISOC_AGENTS_SERVICE_TOKEN") or os.getenv("AISOC_SERVICE_TOKEN") or "").strip()router = APIRouter(prefix="/playbooks", tags=["playbooks"])@@ -63,9 +65,12 @@ def _validate_path_id(value: str, name: str = "id") -> str:async def _proxy(method: str, path: str, **kwargs) -> Any:"""Forward a request to the agents service and return the JSON body."""url = f"{_AGENTS_URL}/api/v1/playbooks{path}"+ headers = dict(kwargs.pop("headers", None) or {})+ if _AGENTS_SERVICE_TOKEN:+ headers.setdefault("Authorization", f"Bearer {_AGENTS_SERVICE_TOKEN}")try:async with httpx.AsyncClient(timeout=60) as client:- r = await client.request(method, url, **kwargs)+ r = await client.request(method, url, headers=headers, **kwargs)if r.status_code >= 400:raise HTTPException(status_code=r.status_code, detail="Upstream service error")if r.status_code == 204:diff --git a/services/api/app/graphql/query.py b/services/api/app/graphql/query.pyindex 423576829..1358e6e61 100644--- a/services/api/app/graphql/query.py+++ b/services/api/app/graphql/query.py@@ -173,11 +173,17 @@ def _orm_to_connector(row: Connector) -> ConnectorType:)+_AGENTS_SERVICE_TOKEN = (os.getenv("AISOC_AGENTS_SERVICE_TOKEN") or os.getenv("AISOC_SERVICE_TOKEN") or "").strip()++async def _proxy_get(path: str, params: dict | None = None): # noqa: ANN201"""Call the agents service and return JSON, or raise on failure."""url = f"{_AGENTS_URL}/api/v1/playbooks{path}"+ _h = {}+ if _AGENTS_SERVICE_TOKEN:+ _h["Authorization"] = f"Bearer {_AGENTS_SERVICE_TOKEN}"async with httpx.AsyncClient(timeout=30) as client:- r = await client.get(url, params=params or {})+ r = await client.get(url, params=params or {}, headers=_h)r.raise_for_status()return r.json()