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(2.5): make the boundary invariant explicit, count the posture-store findings
Beenu Arorac8d54f89ed46
diff --git a/.security/allowlist.yml b/.security/allowlist.ymlindex 4df64c843..a64d6f455 100644--- a/.security/allowlist.yml+++ b/.security/allowlist.yml@@ -207,8 +207,23 @@ ceilings:## If the snapshot is ever reshaped to write into one fixed table keyed by# a run id, both findings go away and this ceiling should come back down.- total: 105- error: 40+ #+ # 105/40 -> 109/44. Four `avoid-sqlalchemy-text` findings, all on+ # `services/api/app/services/posture_store.py`, where three statements+ # interpolate `_COLUMNS` into a `RETURNING` or `SELECT` list.+ #+ # Counted rather than suppressed, same reasoning as the bulk-close pair+ # above. `_COLUMNS` is a module-level string literal naming fourteen+ # columns; nothing assigns to it and no caller reaches it, so there is no+ # path by which request data becomes part of the statement. A column list+ # cannot be a bind parameter in SQL, which is why interpolation is the+ # only way to write one -- the same reason a table name is interpolated+ # two entries up.+ #+ # If the store is ever rewritten against the ORM rather than `text()`,+ # all four go away and this ceiling should come back down.+ total: 109+ error: 44measured_with: "1.86.0"checkov:failed: 219diff --git a/scripts/mypy_baseline.json b/scripts/mypy_baseline.jsonindex bc50281c7..1a59014f5 100644--- a/scripts/mypy_baseline.json+++ b/scripts/mypy_baseline.json@@ -1,9 +1,9 @@{"(environment)": {"flags": "--no-color-output --no-error-summary --no-site-packages --no-incremental",- "mypy": "2.3.1",+ "mypy": "2.4.0","mypy_major": "2",- "python": "3.12"+ "python": "3.11"},"(unmanaged)": {"plugins/mttr-widget/plugin.py": {@@ -467,21 +467,15 @@"app/connectors/ai_gateway.py": {"attr-defined": 1},- "app/connectors/aws_security_hub.py": {- "override": 1- },"app/connectors/email_inbox.py": {"union-attr": 4},- "app/connectors/github.py": {- "override": 1- },"app/connectors/oci.py": {"operator": 1,"union-attr": 7},- "app/connectors/okta.py": {- "override": 1+ "app/connectors/posture/aws.py": {+ "no-redef": 1},"tests/test_pipeline_filter_rules.py": {"arg-type": 1diff --git a/services/api/app/services/effective_permissions/aws.py b/services/api/app/services/effective_permissions/aws.pyindex 962b1f03b..9e8ad0880 100644--- a/services/api/app/services/effective_permissions/aws.py+++ b/services/api/app/services/effective_permissions/aws.py@@ -416,7 +416,13 @@ class AwsIamResolver(Resolver):identity_capped = identity_allowboundary_blocked: set[str] = set()- if boundary_allowed is not None:+ # Both, not just `boundary_allowed`. The two are equivalent by+ # construction -- `boundary_allowed` is assigned only inside the+ # `boundary is not None` branch above -- but that invariant lives+ # fifteen lines away and nothing enforces it, so a later edit that+ # assigns `boundary_allowed` anywhere else turns the `boundary.get`+ # below into an AttributeError on a path an analyst reaches.+ if boundary_allowed is not None and boundary is not None and boundary_id:identity_capped = identity_allow & boundary_allowedboundary_blocked = identity_allow - boundary_allowedif boundary_allow or boundary_blocked:diff --git a/services/api/tests/test_posture_store.py b/services/api/tests/test_posture_store.pyindex 930b1ef46..8128c2097 100644--- a/services/api/tests/test_posture_store.py+++ b/services/api/tests/test_posture_store.py@@ -307,8 +307,16 @@ async def test_providers_version_independently(db) -> None:gh = await _save(db, _snapshot(5), provider="github", connector_id="github")await _save(db, _snapshot(4))- assert (await live_snapshot(db, tenant_id=TENANT, provider="github")).id == gh.id- assert (await live_snapshot(db, tenant_id=TENANT, provider="aws")).id != aws.id+ # Bound and asserted non-None first: `live_snapshot` returns Optional,+ # and dereferencing it inline would report "NoneType has no attribute+ # id" when the real failure is that no live row exists at all.+ live_github = await live_snapshot(db, tenant_id=TENANT, provider="github")+ live_aws = await live_snapshot(db, tenant_id=TENANT, provider="aws")+ assert live_github is not None, "github has no live snapshot"+ assert live_aws is not None, "aws has no live snapshot"++ assert live_github.id == gh.id+ assert live_aws.id != aws.id@pytest.mark.asyncio