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(api): make lake:read_schema and actions:execute mintable into keys (#1264)

antigravitysoham-eng8ddb21ae599d
diff --git a/services/api/app/api/v1/endpoints/api_keys.py b/services/api/app/api/v1/endpoints/api_keys.py
index 19e221d40..758ed74b6 100644
--- a/services/api/app/api/v1/endpoints/api_keys.py
+++ b/services/api/app/api/v1/endpoints/api_keys.py
@@ -67,6 +67,13 @@ VALID_SCOPES: frozenset[str] = frozenset(
"actions:read",
"lake:query",
"hunts:read",
+ # The other two permissions the agent-tool surface enforces. The MCP
+ # server authenticates with a key, so without these aisoc_lake_schema
+ # (GET /lake/schema) and aisoc_preview_action (the dry-run, which
+ # `actions:execute` gates; live containment still needs an approver)
+ # were reachable only with "*".
+ "lake:read_schema",
+ "actions:execute",
# Depth 8.2. Mintable so a tenant can automate its own access
# governance — an on-call rotation approving elevations from a
# script, a change-management job adding a condition for a
diff --git a/services/api/tests/test_access_governance.py b/services/api/tests/test_access_governance.py
index 58df5e2d3..53c3235d0 100644
--- a/services/api/tests/test_access_governance.py
+++ b/services/api/tests/test_access_governance.py
@@ -350,6 +350,15 @@ class TestTheTwoVocabulariesAgree:
):
assert permission in VALID_SCOPES, f"{permission} can only be reached by a wildcard key"
+ def test_every_agent_tool_permission_is_mintable_into_a_key(self) -> None:
+ """The MCP server authenticates with an API key. `aisoc_lake_schema`
+ (GET /lake/schema, `lake:read_schema`) and `aisoc_preview_action`
+ (POST /live-actions/dry-run, `actions:execute`) answered 403 to any
+ key short of `*`, because neither permission could be minted."""
+ for permission in ("lake:query", "lake:read_schema", "actions:read", "actions:execute", "hunts:read"):
+ assert permission in VALID_SCOPES, f"{permission} can only be reached by a wildcard key"
+ assert permission in ROLE_PERMISSIONS["tenant_admin"], f"{permission} is mintable but held by no admin"
+
def test_a_non_wildcard_role_can_request_and_approve_an_elevation(self) -> None:
"""Otherwise the feature is reachable only by principals who do not
need it, which is how `hunts:read` ended up held by nobody."""