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.

docs: correct the generated-secret count and stop it going stale again (#979)

Beenu Arora3eb4aa85b0ea
diff --git a/.env.example b/.env.example
index a595f787c..54bfec002 100644
--- a/.env.example
+++ b/.env.example
@@ -153,7 +153,7 @@ CONNECTORS_SERVICE_TIMEOUT_SECONDS=15
# them across the stack. They are deliberately different values: they are
# different privilege levels.
#
-# Empty here and generated by `scripts/ensure_env.py`, like the six secrets
+# Empty here and generated by `scripts/ensure_env.py`, like the secrets
# above. This file used to ship `POSTGRES_PASSWORD=aisoc_dev_secret`, and
# `docker-compose.prod.yml` guarded it with
# `${POSTGRES_PASSWORD:?… the development default is a published literal}` —
diff --git a/README.md b/README.md
index 236cf5e62..6f97af9a0 100644
--- a/README.md
+++ b/README.md
@@ -57,9 +57,9 @@ Needs Docker Compose v2 with **8 GB memory and 20 GB free disk in the Docker VM*
was measured against. The first run downloads a ~2 GB language model into a named volume; only
`make clean` fetches it again.
-`make up` also creates `.env` and generates the **six** secrets in it — the credential vault, the
-session signing key, and the four service-to-service credentials — then creates an administrator and
-prints its password. That password is generated on your machine, shown once, and stored nowhere:
+`make up` also creates `.env` and generates the **ten** secrets in it — the credential vault, the
+session signing key, the four service-to-service credentials and the four datastore passwords — then
+creates an administrator and prints its password. That password is generated on your machine, shown once, and stored nowhere:
copy it, or mint a new one with `make bootstrap ARGS=--reset-password`.
Then **prove it actually works**. `make smoke` posts one real event to the ingest API, follows it
diff --git a/apps/docs/docs/deployment/docker.md b/apps/docs/docs/deployment/docker.md
index e65fc9bf7..a67873799 100644
--- a/apps/docs/docs/deployment/docker.md
+++ b/apps/docs/docs/deployment/docker.md
@@ -117,7 +117,7 @@ COMPOSE_PROFILES=connectors,osquery,slack docker compose up -d
## Production
```bash
-make env # generates the six service secrets
+make env # generates the ten secrets the stack needs
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index a1f450f93..76c7501ab 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -168,7 +168,7 @@ services:
DATABASE_URL: postgresql+asyncpg://aisoc_app:${AISOC_APP_DB_PASSWORD:?set AISOC_APP_DB_PASSWORD}@postgres:5432/aisoc
DATABASE_MIGRATION_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@postgres:5432/aisoc
REDIS_URL: redis://:${REDIS_PASSWORD:?set REDIS_PASSWORD}@redis:6379/0
- # `make env` generates all six of these. They are required rather than
+ # `make env` generates all of these. They are required rather than
# defaulted because a service that starts without one either serves
# unauthenticated or signs with a key published in this repository —
# both were reported vulnerabilities, fixed in v12.0.0.
diff --git a/tests/test_env_placeholder_gate.py b/tests/test_env_placeholder_gate.py
index ff1ea1cd1..5fad9e959 100644
--- a/tests/test_env_placeholder_gate.py
+++ b/tests/test_env_placeholder_gate.py
@@ -202,6 +202,39 @@ def test_generated_secrets_ship_empty(key: str) -> None:
)
+#: Prose that states, in words, how many secrets first run generates. Each is
+#: a place a reader is told a number; none of them was derived from anything.
+_COUNTED_IN_PROSE = (
+ ("README.md", "generates the **{word}** secrets in it"),
+ ("apps/docs/docs/deployment/docker.md", "generates the {word} secrets the stack needs"),
+)
+
+_NUMBER_WORDS = ("zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen").split()
+
+
+def test_the_published_count_is_the_real_count() -> None:
+ """A count copied into prose goes stale silently.
+
+ README said "the **six** secrets" while `GENERATED` held ten, because the
+ two lists were maintained by hand and compared by nothing — the same
+ shape as the detector-versus-template drift this file exists for. The
+ number is spelled in words on purpose (it reads better in a sentence),
+ so it is derived and compared rather than matched loosely.
+ """
+ expected = _NUMBER_WORDS[len(ensure_env.GENERATED)]
+ stale: list[str] = []
+ for relative, template in _COUNTED_IN_PROSE:
+ text = (REPO / relative).read_text(encoding="utf-8")
+ if template.format(word=expected) not in text:
+ found = [w for w in _NUMBER_WORDS if template.format(word=w) in text]
+ stale.append(f" {relative}: says {found or ['nothing matching the sentence']}, should say {expected!r}")
+ assert not stale, (
+ f"scripts/ensure_env.py generates {len(ensure_env.GENERATED)} secrets and these disagree:\n"
+ + "\n".join(stale)
+ + "\n\nIf the sentence was reworded, update _COUNTED_IN_PROSE in this file so it keeps being checked."
+ )
+
+
def test_ensure_env_fills_exactly_the_empty_and_placeholder_secrets(tmp_path: Path) -> None:
"""End-to-end over the real template: copy, generate, and check the result."""
env = tmp_path / ".env"