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): live suites seed the state the product requires (nightly env secrets, scheduler SSRF allowlist) (#1432)

Beenu Arorab6254370a4d5
diff --git a/.github/workflows/compose-smoke-nightly.yml b/.github/workflows/compose-smoke-nightly.yml
index eaaa70159..a849381cd 100644
--- a/.github/workflows/compose-smoke-nightly.yml
+++ b/.github/workflows/compose-smoke-nightly.yml
@@ -65,7 +65,16 @@ jobs:
- name: Seed environment file
run: |
- cp .env.example .env
+ # The same generator `make up` runs. A plain `cp .env.example .env`
+ # leaves every generated secret empty — deliberately, that file
+ # ships them empty for scripts/ensure_env.py to fill — and with
+ # ENVIRONMENT defaulting to production the API then *refuses to
+ # boot* (InsecureProductionDefaultsError names all six), so the
+ # stack could never converge: this job failed every night on
+ # "api /health 200: 0" long before the litellm tag deletion added
+ # a second failure in front of it. Seeding the real first-run way
+ # means this smoke exercises the path an operator actually takes.
+ python3 scripts/ensure_env.py
# AISOC_VERSION is overridden purely for clarity in `docker ps`
# output — every image is built locally so the tag is just a label.
if grep -q '^AISOC_VERSION=' .env; then
diff --git a/tests/isolation/test_connector_scheduler_live.py b/tests/isolation/test_connector_scheduler_live.py
index 95beba02c..9fd988fb5 100644
--- a/tests/isolation/test_connector_scheduler_live.py
+++ b/tests/isolation/test_connector_scheduler_live.py
@@ -213,11 +213,28 @@ async def connector_row(engine, vendor): # noqa: ANN001
@pytest_asyncio.fixture(scope="module", loop_scope="module")
async def scheduler(engine, ingest, connector_row): # noqa: ANN001
- """The real `ConnectorScheduler`, started."""
+ """The real `ConnectorScheduler`, started — with the mock vendor admitted.
+
+ GHSA-cq4g-g6wp-4m2w put the SSRF guard on every scheduled poll, and the
+ guard refuses loopback unconditionally unless the operator names the host
+ in ``AISOC_SSRF_ALLOW_HOSTS`` (``ALLOW_PRIVATE`` deliberately never admits
+ loopback). The mock vendor this suite polls lives on ``127.0.0.1``, so
+ without the variable the scheduler *correctly* refuses to poll it — the
+ guard working, not the scheduler failing, which is exactly how this suite
+ went red the moment the guard landed while the quota noise on that day's
+ runners hid the real failure under pull errors. Setting the variable here
+ is not a test-only bypass: it is the documented operator path for a vendor
+ on a named internal host, exercised end to end — the guard reads it per
+ validation, admits exactly this host, and keeps refusing everything else
+ (the cloud-metadata blocklist cannot be overridden by it at all).
+ """
from app.ingest_client import IngestClient
from app.scheduler import ConnectorScheduler
from app.security.credential_vault import get_vault
+ previous = os.environ.get("AISOC_SSRF_ALLOW_HOSTS")
+ os.environ["AISOC_SSRF_ALLOW_HOSTS"] = "127.0.0.1"
+
instance = ConnectorScheduler(
engine=engine,
ingest_client=IngestClient(base_url=ingest),
@@ -227,6 +244,10 @@ async def scheduler(engine, ingest, connector_row): # noqa: ANN001
await instance.start()
yield instance
await instance.stop()
+ if previous is None:
+ os.environ.pop("AISOC_SSRF_ALLOW_HOSTS", None)
+ else:
+ os.environ["AISOC_SSRF_ALLOW_HOSTS"] = previous
class TestTheJobIsScheduledToRun: