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: a real signature bug CodeQL caught, and pass Fly's own error through (#698)

Beenu Aroradf3c52076be2
diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml
index 328f77c9d..770271a0b 100644
--- a/.github/workflows/deploy-api.yml
+++ b/.github/workflows/deploy-api.yml
@@ -55,10 +55,15 @@ jobs:
echo "deploy=false" >> "$GITHUB_OUTPUT"
elif ! flyctl status --app aisoc-demo-api >/dev/null 2>&1; then
echo "Fly app 'aisoc-demo-api' not found — creating it."
- if flyctl apps create aisoc-demo-api --org personal; then
+ # Capture the vendor's own error rather than guessing. The
+ # first real run of this said "Your account has overdue
+ # invoices", which no list of plausible reasons would have
+ # included, and which is the actual reason the demo is down.
+ if create_output=$(flyctl apps create aisoc-demo-api --org personal 2>&1); then
echo "deploy=true" >> "$GITHUB_OUTPUT"
else
- echo "::error title=deploy-api::Could not create 'aisoc-demo-api'. The token may lack org permissions, or the name may be taken."
+ echo "$create_output"
+ echo "::error title=deploy-api::Could not create 'aisoc-demo-api'. Fly said: ${create_output//$'\n'/ }"
exit 1
fi
else
diff --git a/.github/workflows/deploy-web.yml b/.github/workflows/deploy-web.yml
index 4109fbc1d..549ff606e 100644
--- a/.github/workflows/deploy-web.yml
+++ b/.github/workflows/deploy-web.yml
@@ -54,8 +54,14 @@ jobs:
# nobody reads.
if ! flyctl status --app aisoc-demo-web >/dev/null 2>&1; then
echo "Fly app 'aisoc-demo-web' not found — creating it."
- if ! flyctl apps create aisoc-demo-web --org personal; then
- echo "::error title=deploy-web::Could not create 'aisoc-demo-web'. The token may lack org permissions, or the name may be taken."
+ # Capture the vendor's own error rather than guessing at the
+ # cause. The first real run of this said "Your account has
+ # overdue invoices", which no list of plausible reasons would
+ # have included — and which is the actual reason the public
+ # demo has been unreachable.
+ if ! create_output=$(flyctl apps create aisoc-demo-web --org personal 2>&1); then
+ echo "$create_output"
+ echo "::error title=deploy-web::Could not create 'aisoc-demo-web'. Fly said: ${create_output//$'\n'/ }"
exit 1
fi
fi
diff --git a/scripts/generate_connector_docs.py b/scripts/generate_connector_docs.py
index 4c3b7b608..8cf76f423 100644
--- a/scripts/generate_connector_docs.py
+++ b/scripts/generate_connector_docs.py
@@ -203,11 +203,15 @@ def render(schema, human: str) -> str:
names = ", ".join(f"`{f.name}`" for f in secret_fields)
lines += [
":::note Credential handling",
- f"{names} " + ("is" if len(secret_fields) == 1 else "are") + " encrypted at "
- "rest by the credential vault before the row is written, and decrypted only "
- "at poll time. The value is never logged and never returned by the API — a "
- "read of the saved connector shows the field as set, not its contents. See "
- "[credential vault](../operations/credentials.md).",
+ (
+ f"{names} "
+ + ("is" if len(secret_fields) == 1 else "are")
+ + " encrypted at rest by the credential vault before the row is "
+ "written, and decrypted only at poll time. The value is never "
+ "logged and never returned by the API — a read of the saved "
+ "connector shows the field as set, not its contents. See "
+ "[credential vault](../operations/credentials.md)."
+ ),
":::",
"",
]
@@ -278,10 +282,14 @@ def render_field_reference(schema) -> str:
names = ", ".join(f"`{f.name}`" for f in secret_fields)
lines += [
":::note Credential handling",
- f"{names} " + ("is" if len(secret_fields) == 1 else "are") + " encrypted "
- "at rest by the credential vault before the row is written, and decrypted "
- "only at poll time. The value is never logged and never returned by the "
- "API. See [credential vault](../operations/credentials.md).",
+ (
+ f"{names} "
+ + ("is" if len(secret_fields) == 1 else "are")
+ + " encrypted at rest by the credential vault before the row is "
+ "written, and decrypted only at poll time. The value is never "
+ "logged and never returned by the API. See "
+ "[credential vault](../operations/credentials.md)."
+ ),
":::",
"",
]
diff --git a/services/actions/app/clients/azure_entra_client.py b/services/actions/app/clients/azure_entra_client.py
index eb96d862e..e4f12f27d 100644
--- a/services/actions/app/clients/azure_entra_client.py
+++ b/services/actions/app/clients/azure_entra_client.py
@@ -119,11 +119,17 @@ class AzureEntraClient:
Returns ``None`` on any failure: indeterminate, never a confirmation.
"""
try:
- token = await self._ensure_token()
async with httpx.AsyncClient(timeout=20.0) as client:
+ # _ensure_token takes the client and stores the token on the
+ # instance; it does not return one. Calling it bare and using
+ # the result as a bearer token raised TypeError on every live
+ # call — invisible in simulation, which never constructs a
+ # client. Same class as the executor/client signature drift
+ # the autospec'd tests exist to catch.
+ await self._ensure_token(client)
resp = await client.get(
- f"https://graph.microsoft.com/v1.0/users/{user_principal_name}" "?$select=accountEnabled",
- headers={"Authorization": f"Bearer {token}"},
+ f"{_GRAPH}/users/{user_principal_name}?$select=accountEnabled",
+ headers=self._headers(),
)
if resp.status_code != 200:
return None
diff --git a/tests/test_detection_id_stability.py b/tests/test_detection_id_stability.py
index 8ab1f0cf3..d52f70899 100644
--- a/tests/test_detection_id_stability.py
+++ b/tests/test_detection_id_stability.py
@@ -24,6 +24,10 @@ sys.path.insert(0, str(REPO_ROOT / "scripts"))
LOCK_PATH = REPO_ROOT / "detections" / "rule-ids.lock.json"
+# Imported for its side effect of populating sys.modules, so the corrupt-
+# lock test can patch the module object without a second import style.
+import generate_detections # noqa: E402,F401
+
@pytest.fixture(scope="module")
def categories() -> dict:
@@ -109,11 +113,14 @@ def test_every_locked_id_is_unique() -> None:
def test_a_corrupt_lock_refuses_rather_than_renumbering(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""Silently treating an unreadable lock as empty would reassign every id."""
- import generate_detections as module
-
bad = tmp_path / "rule-ids.lock.json"
bad.write_text("{not json", encoding="utf-8")
- monkeypatch.setattr(module, "ID_LOCK", bad)
+ # setattr on the module object reached through sys.modules, so the file
+ # keeps a single import style — mixing `import X as m` with `from X
+ # import y` for the same module is what CodeQL flags.
+ monkeypatch.setattr(sys.modules["generate_detections"], "ID_LOCK", bad)
+
+ from generate_detections import load_id_lock
with pytest.raises(SystemExit, match="unreadable"):
- module.load_id_lock()
+ load_id_lock()