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(ci): regenerate the spec, and teach the SCIM gate about derived roles

Beenu Arora6fc5719a79f5
diff --git a/docs/openapi.yaml b/docs/openapi.yaml
index 7e8f98be6..d25a53955 100644
--- a/docs/openapi.yaml
+++ b/docs/openapi.yaml
@@ -31,6 +31,26 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
+ /api/v1/auth/sso/status:
+ get:
+ tags:
+ - auth
+ summary: Sso Status
+ description: 'What the login screen asks before it offers SSO. Public: it reveals
+
+ only that SSO is offered, under what label, and whether password sign-in
+
+ remains open -- never issuers, client ids, endpoints or secrets.'
+ operationId: sso_status_api_v1_auth_sso_status_get
+ responses:
+ '200':
+ description: Successful Response
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ type: object
+ title: Response Sso Status Api V1 Auth Sso Status Get
/api/v1/auth/refresh:
post:
tags:
@@ -7751,7 +7771,7 @@ paths:
24h ago). Values are percentage changes rounded to two decimals; a delta
- of ``0.0`` means "no meaningful baseline" (the previous window was empty).'
+ of ``None`` means "no baseline" (the previous window was empty).'
operationId: get_funnel_metrics_api_v1_metrics_funnel_get
security:
- HTTPBearer: []
@@ -18349,6 +18369,16 @@ components:
type: array
title: Recommended Actions
default: []
+ raw_event:
+ additionalProperties: true
+ type: object
+ title: Raw Event
+ default: {}
+ wazuh_locator:
+ additionalProperties: true
+ type: object
+ title: Wazuh Locator
+ default: {}
type: object
required:
- id
@@ -18894,12 +18924,12 @@ components:
type: array
- type: 'null'
title: Tags
- assigned_to_id:
+ assignee:
anyOf:
- type: string
format: uuid
- type: 'null'
- title: Assigned To Id
+ title: Assignee
case_id:
anyOf:
- type: string
@@ -22393,6 +22423,10 @@ components:
title: CspmScanResponse
DashboardMetrics:
properties:
+ period:
+ type: string
+ title: Period
+ default: 24h
alerts:
$ref: '#/components/schemas/AlertMetrics'
cases:
@@ -24464,33 +24498,43 @@ components:
FunnelDeltas:
properties:
events_of_interest:
- type: number
+ anyOf:
+ - type: number
+ - type: 'null'
title: Events Of Interest
correlation_instances:
- type: number
+ anyOf:
+ - type: number
+ - type: 'null'
title: Correlation Instances
alerts_generated:
- type: number
+ anyOf:
+ - type: number
+ - type: 'null'
title: Alerts Generated
signal_to_noise:
- type: number
+ anyOf:
+ - type: number
+ - type: 'null'
title: Signal To Noise
mttd_seconds:
- type: number
+ anyOf:
+ - type: number
+ - type: 'null'
title: Mttd Seconds
analyst_queue_depth:
- type: number
+ anyOf:
+ - type: number
+ - type: 'null'
title: Analyst Queue Depth
type: object
- required:
- - events_of_interest
- - correlation_instances
- - alerts_generated
- - signal_to_noise
- - mttd_seconds
- - analyst_queue_depth
title: FunnelDeltas
- description: Period-over-period percentage deltas for the funnel KPI bar.
+ description: 'Period-over-period percentage deltas for the funnel KPI bar.
+
+
+ ``None`` means the previous window was empty — no baseline exists, and
+
+ the UI renders that as "no baseline" instead of a misleading 0%.'
FunnelMetrics:
properties:
period:
@@ -32449,6 +32493,24 @@ components:
- type: string
- type: 'null'
title: Metadata Xml
+ allowed_email_domains:
+ type: string
+ maxLength: 2000
+ title: Allowed Email Domains
+ default: ''
+ jit_provisioning:
+ type: boolean
+ title: Jit Provisioning
+ default: true
+ group_role_mode:
+ type: string
+ title: Group Role Mode
+ default: first_login_only
+ login_label:
+ type: string
+ maxLength: 80
+ title: Login Label
+ default: ''
type: object
required:
- provider
@@ -32484,6 +32546,18 @@ components:
default_role:
type: string
title: Default Role
+ allowed_email_domains:
+ type: string
+ title: Allowed Email Domains
+ jit_provisioning:
+ type: boolean
+ title: Jit Provisioning
+ group_role_mode:
+ type: string
+ title: Group Role Mode
+ login_label:
+ type: string
+ title: Login Label
metadata_url:
anyOf:
- type: string
@@ -32512,6 +32586,10 @@ components:
- enabled
- group_role_mapping
- default_role
+ - allowed_email_domains
+ - jit_provisioning
+ - group_role_mode
+ - login_label
- metadata_url
- has_metadata_xml
- created_at
@@ -34389,6 +34467,11 @@ components:
- contained
- resolved
- closed
+ - open
+ - in_progress
+ - pending
+ - pending_closure
+ - cancelled
- type: 'null'
title: Status
assignee:
@@ -34647,6 +34730,11 @@ components:
- type: boolean
- type: 'null'
title: Is Active
+ reason:
+ anyOf:
+ - type: string
+ - type: 'null'
+ title: Reason
type: object
title: UpdateUserRequest
UpsertAlertGraphRequest:
diff --git a/scripts/check_scim_contract.py b/scripts/check_scim_contract.py
index fa35828d1..6060b1758 100644
--- a/scripts/check_scim_contract.py
+++ b/scripts/check_scim_contract.py
@@ -220,8 +220,38 @@ def _dict_literal(tree: ast.Module, function: str) -> dict | None:
return None
+def _subscript_keys(tree: ast.Module, variable: str) -> set[str]:
+ """Keys added after the literal, as ``VARIABLE["key"] = ...``.
+
+ A role can be *derived* rather than written out -- `infosec` is the union
+ of `soc_analyst` and `threat_hunter`, which cannot be expressed inside the
+ dict literal -- so it is assigned on a following line. Reading only the
+ literal made this gate report a working role as granting nothing, which is
+ worse than silence: a false finding on correct code is how a gate gets
+ suppressed, and then it catches the real one too.
+ """
+ keys: set[str] = set()
+ for node in ast.walk(tree):
+ if not isinstance(node, ast.Assign):
+ continue
+ for target in node.targets:
+ if (
+ isinstance(target, ast.Subscript)
+ and isinstance(target.value, ast.Name)
+ and target.value.id == variable
+ and isinstance(target.slice, ast.Constant)
+ and isinstance(target.slice.value, str)
+ ):
+ keys.add(target.slice.value)
+ return keys
+
+
def _assigned_names(tree: ast.Module, variable: str) -> set[str] | None:
- """Keys of a module-level dict, or members of a tuple/set/frozenset."""
+ """Keys of a module-level dict, or members of a tuple/set/frozenset.
+
+ Includes keys added by a later ``VARIABLE["key"] = ...`` assignment, which
+ is how a role derived from other roles has to be written.
+ """
for node in ast.walk(tree):
if not isinstance(node, ast.Assign):
continue
@@ -233,7 +263,7 @@ def _assigned_names(tree: ast.Module, variable: str) -> set[str] | None:
except (ValueError, TypeError, SyntaxError):
return None
if isinstance(value, dict):
- return set(value)
+ return set(value) | _subscript_keys(tree, variable)
if isinstance(value, list | tuple | set | frozenset):
return set(value)
for node in ast.walk(tree):
@@ -245,7 +275,7 @@ def _assigned_names(tree: ast.Module, variable: str) -> set[str] | None:
except (ValueError, TypeError, SyntaxError):
return None
if isinstance(value, dict):
- return set(value)
+ return set(value) | _subscript_keys(tree, variable)
if isinstance(value, list | tuple | set | frozenset):
return set(value)
return None
diff --git a/services/api/tests/test_threat_intel_rbac.py b/services/api/tests/test_threat_intel_rbac.py
index b96508106..e8dfce90f 100644
--- a/services/api/tests/test_threat_intel_rbac.py
+++ b/services/api/tests/test_threat_intel_rbac.py
@@ -45,7 +45,10 @@ from fastapi import HTTPException
# ─── Static role-permission map (the source of truth) ────────────────────
-WRITE_ROLES = ("admin", "platform_admin", "tenant_admin", "soc_lead", "threat_hunter")
+# `infosec` is the union of `soc_analyst` and `threat_hunter`, so it inherits
+# `threat_intel:write` from the latter. Classified by what it actually holds
+# rather than by where the name sounds like it belongs.
+WRITE_ROLES = ("admin", "platform_admin", "tenant_admin", "soc_lead", "threat_hunter", "infosec")
READ_ONLY_ROLES = ("soc_analyst", "viewer", "api_service")