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
The dependency audit never looked at the second pnpm install root (#833)
Beenu Arorae92f8188ce70
diff --git a/.github/workflows/attribution.yml b/.github/workflows/attribution.ymlindex a777ed75b..9da76be48 100644--- a/.github/workflows/attribution.yml+++ b/.github/workflows/attribution.yml@@ -15,7 +15,15 @@ name: Attribution# skips is indistinguishable from a gate that passes.on:+ # `edited` matters because the body is half of what this gate reads. Without+ # it the default types (opened, synchronize, reopened) mean a body edited to+ # add an attribution footer after the last push is never re-checked — and a+ # body corrected after a failure cannot be revalidated, because re-running a+ # `pull_request` job replays the original event payload rather than fetching+ # the current body. That is how this gate first caught a footer the tooling+ # appends at PR-creation time: the only way to clear it was another push.pull_request:+ types: [opened, synchronize, reopened, edited]push:branches: [main]workflow_dispatch:diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 166c623ed..5be21badf 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -152,6 +152,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed+- **The dependency audit only ever looked at one of the repository's two pnpm+ install roots.** `run_pnpm_audit` ran `pnpm audit` in the repo root and+ nowhere else, so `apps/mobile` — a deliberately separate install root, with+ its own `pnpm-workspace.yaml` so its installs stop rewriting the root lock —+ was never scanned. Two high-severity advisories stood open there while the+ `security-audit` job reported a clean workspace, which is the same shape as+ the stale `poetry.lock` that once dropped `services/slack-bot` and hid eleven+ advisories. Install roots are now discovered from the tree (every directory+ holding a `pnpm-lock.yaml`), each is audited, and a finding names the root it+ came from rather than a generic "pnpm workspace". A tree with no lockfile+ anywhere is recorded as a coverage gap instead of reported as clean.++ The two advisories it surfaced (`GHSA-5p2g-fcmc-qvqq`, `GHSA-w3rx-r6r6-pgpr`+ in `image-size`) are suppressed with an expiry rather than fixed, because no+ fix is reachable: `apps/mobile` resolves `image-size 1.2.1` solely through+ `metro 0.83.3`, no patched 1.x exists, every metro release through 0.87.1+ still requires `^1.0.2`, and `image-size` 2.x drops the callable default+ export `metro/src/Assets.js` calls — so an override would break asset+ resolution at bundle time rather than bump a version. Dependabot's updater+ reaches the same verdict independently (`security_update_not_possible`).+ Both are denial-of-service only and build-time, reachable only from an image+ already committed to this repository.+- **AI triage could not reach a model in the default deployment, and it wasnot a missing key.** `docker-compose.yml` set `LLM_GATEWAY_URL` on the `api`and `agents` services. Nothing read it. Both resolvers honoured onlydiff --git a/scripts/security_audit.py b/scripts/security_audit.pyindex 34765a3c0..cea249397 100644--- a/scripts/security_audit.py+++ b/scripts/security_audit.py@@ -164,7 +164,29 @@ def is_ignored(tool: str, vuln_ids: list[str], ignores: list[Ignore]) -> Ignore# ─── pnpm scanner ────────────────────────────────────────────────────────────-def classify_pnpm_audit(audit_json: dict[str, Any], ignores: list[Ignore]) -> Report:+def pnpm_install_roots(repo_root: Path) -> list[str]:+ """Every directory holding its own ``pnpm-lock.yaml``, relative to the repo root.++ Read from the tree rather than listed, because a listed set is the artefact+ that drifts. ``apps/mobile`` is a deliberately separate install root — it+ has its own ``pnpm-workspace.yaml`` so its installs stop rewriting the root+ lock — and auditing only the repo root never saw it. Two high-severity+ advisories stood open there while this arm reported a clean workspace.+ """+ proc = subprocess.run(+ ["git", "ls-files", "-z", "*pnpm-lock.yaml"],+ cwd=repo_root,+ capture_output=True,+ text=True,+ )+ return sorted({str(Path(p).parent) for p in proc.stdout.split("\0") if p})+++def classify_pnpm_audit(+ audit_json: dict[str, Any],+ ignores: list[Ignore],+ location: str = "pnpm workspace",+) -> Report:"""Classify pnpm audit JSON into a Report using native severity."""report = Report()@@ -181,7 +203,7 @@ def classify_pnpm_audit(audit_json: dict[str, Any], ignores: list[Ignore]) -> Reseverity=severity,vuln_id=all_ids[0] if all_ids else str(advisory.get("id", "unknown")),package=advisory.get("module_name", "unknown"),- location="pnpm workspace",+ location=location,title=advisory.get("title") or advisory.get("overview") or "",)@@ -194,8 +216,29 @@ def classify_pnpm_audit(audit_json: dict[str, Any], ignores: list[Ignore]) -> Redef run_pnpm_audit(repo_root: Path, ignores: list[Ignore]) -> Report:- """Run pnpm audit with fallback registry on 403."""- lockfile = repo_root / "pnpm-lock.yaml"+ """Audit every pnpm install root in the tree, not only the repo root."""+ roots = pnpm_install_roots(repo_root)+ merged = Report()+ if not roots:+ # Zero install roots is not zero workspaces vulnerable. Without this the+ # arm prints "pnpm: 0 findings" over a tree with no lockfile in it,+ # which is the sentence a clean audit also prints.+ merged.unscanned.append(f"no pnpm-lock.yaml anywhere in {repo_root} — NOTHING was scanned")+ return merged++ for rel in roots:+ label = "pnpm workspace" if rel == "." else f"pnpm workspace {rel}"+ part = run_pnpm_audit_at(repo_root / rel, label, ignores)+ merged.findings.extend(part.findings)+ merged.ignored.extend(part.ignored)+ merged.warnings.extend(part.warnings)+ merged.unscanned.extend(part.unscanned)+ return merged+++def run_pnpm_audit_at(root: Path, label: str, ignores: list[Ignore]) -> Report:+ """Run pnpm audit in one install root, with fallback registry on 403."""+ lockfile = root / "pnpm-lock.yaml"if not lockfile.is_file():# `pnpm audit` in a directory with no lockfile has nothing to resolve# and can still answer with an empty advisory set. Refuse instead:@@ -213,7 +256,7 @@ def run_pnpm_audit(repo_root: Path, ignores: list[Ignore]) -> Report:proc = subprocess.run(["pnpm", "audit", "--json"],- cwd=repo_root,+ cwd=root,env=env,capture_output=True,text=True,@@ -233,13 +276,13 @@ def run_pnpm_audit(repo_root: Path, ignores: list[Ignore]) -> Report:# as a coverage gap rather than a warning for the same reason the# Python arm does it: a warning still exits 0, so the job would# report "pnpm: 0 findings" having scanned nothing at all.- report.unscanned.append("pnpm workspace: audit returned unparseable output — NOT scanned")+ report.unscanned.append(f"{label}: audit returned unparseable output — NOT scanned")return report- return classify_pnpm_audit(data, ignores)+ return classify_pnpm_audit(data, ignores, label)report = Report()- report.unscanned.append("pnpm workspace: audit failed on every registry — NOT scanned")+ report.unscanned.append(f"{label}: audit failed on every registry — NOT scanned")return reportdiff --git a/scripts/security_audit_ignores.txt b/scripts/security_audit_ignores.txtindex 2c5c3f616..705127ce8 100644--- a/scripts/security_audit_ignores.txt+++ b/scripts/security_audit_ignores.txt@@ -91,3 +91,38 @@# Add entries back only with a justification that names the version actually# resolved and the fix that is genuinely out of reach. An expiry is a# re-review date, not a snooze.++# ── 2026-09-24 — apps/mobile, a second install root the audit never saw ──────+# The two image-size entries below look like the pair dismissed above and are a+# different case. That one was @docusaurus/mdx-loader holding ^2.0.2 in the root+# workspace, where 2.0.4 is a drop-in. This one is metro, and the fix really is+# out of reach:+#+# • apps/mobile resolves image-size 1.2.1, pulled only by metro 0.83.3.+# • No patched 1.x exists — 1.2.1 is the last 1.x and the fix landed in 2.0.3.+# • Every metro release through the current latest (0.87.1) still declares+# image-size ^1.0.2.+# • metro/src/Assets.js calls the callable default export at lines 68 and 173+# — `(0, _imageSize.default)(content)` — which image-size 2.x replaced with+# named exports. An override here does not bump a version, it breaks asset+# resolution at bundle time.+# • Dependabot's own updater reaches the same verdict independently:+# security_update_not_possible, latest-resolvable 1.2.1,+# lowest-non-vulnerable 2.0.3, conflicting-dependencies [].+#+# Both advisories are denial of service only (CVSS A:H, C:N/I:N) via infinite+# loops in the JXL/HEIF and ICNS parsers. Reaching them needs a malicious image+# inside this repository's own asset tree, which presupposes commit access, and+# the impact is a hung developer bundler. No runtime, server or user-input path+# reaches this code.+#+# Why they were invisible rather than accepted is the part worth keeping:+# `pnpm audit` ran only at the repo root, and apps/mobile is a deliberately+# separate install root, so this arm reported a clean workspace while two high+# advisories stood open. run_pnpm_audit now discovers every directory holding a+# pnpm-lock.yaml, so a third install root is covered the day it appears rather+# than the day someone remembers it exists.+#+# Retire these when metro adopts image-size >= 2.0.3.+pnpm|GHSA-5p2g-fcmc-qvqq|apps/mobile resolves image-size 1.2.1 through metro 0.83.3; no 1.x fix exists, metro through 0.87.1 still requires ^1.0.2, and image-size 2.x drops the callable default export metro calls in Assets.js. DoS-only and build-time, reachable only from an image already committed to this repo|2026-12-23+pnpm|GHSA-w3rx-r6r6-pgpr|apps/mobile resolves image-size 1.2.1 through metro 0.83.3; no 1.x fix exists, metro through 0.87.1 still requires ^1.0.2, and image-size 2.x drops the callable default export metro calls in Assets.js. DoS-only and build-time, reachable only from an image already committed to this repo|2026-12-23diff --git a/scripts/tests/test_security_audit.py b/scripts/tests/test_security_audit.pyindex c43f48a9f..775361d7d 100644--- a/scripts/tests/test_security_audit.py+++ b/scripts/tests/test_security_audit.py@@ -544,6 +544,74 @@ class TestNothingToScanIsNotACleanScan:assert report.unscanned, "no pnpm-lock.yaml must be a coverage gap"assert exit_code_for(report) == 1+ def test_pnpm_audits_every_install_root_not_only_the_repo_root(self, monkeypatch, tmp_path: Path):+ """A second install root must be audited, and its findings must name it.++ ``apps/mobile`` keeps its own ``pnpm-workspace.yaml`` so its installs+ stop rewriting the root lock. Auditing only the repo root therefore+ never reached it, and this arm reported a clean workspace while two+ high-severity advisories stood open there.+ """+ (tmp_path / "pnpm-lock.yaml").write_text("lockfileVersion: '6.0'\n")+ nested = tmp_path / "apps" / "mobile"+ nested.mkdir(parents=True)+ (nested / "pnpm-lock.yaml").write_text("lockfileVersion: '6.0'\n")++ monkeypatch.setattr(+ security_audit,+ "pnpm_install_roots",+ lambda root: [".", "apps/mobile"],+ )++ audited: list[Path] = []++ def fake_at(root: Path, label: str, ignores):+ audited.append(root)+ report = Report()+ if label.endswith("apps/mobile"):+ report.findings.append(+ Finding(+ tool="pnpm",+ severity="high",+ vuln_id="GHSA-5p2g-fcmc-qvqq",+ package="image-size",+ location=label,+ title="denial of service",+ )+ )+ return report++ monkeypatch.setattr(security_audit, "run_pnpm_audit_at", fake_at)++ report = run_pnpm_audit(tmp_path, [])++ assert audited == [tmp_path, tmp_path / "apps/mobile"], "both install roots must be audited"+ assert len(report.findings) == 1+ assert report.findings[0].location == "pnpm workspace apps/mobile", (+ "a finding must name the install root it came from, not a generic 'pnpm workspace'"+ )+ assert exit_code_for(report) == 1++ def test_pnpm_install_roots_are_read_from_the_tree(self, tmp_path: Path):+ """Discovery is structural, so a new install root needs no edit here."""+ import subprocess++ subprocess.run(["git", "init", "-q"], cwd=tmp_path, check=True)+ (tmp_path / "pnpm-lock.yaml").write_text("lockfileVersion: '6.0'\n")+ nested = tmp_path / "apps" / "mobile"+ nested.mkdir(parents=True)+ (nested / "pnpm-lock.yaml").write_text("lockfileVersion: '6.0'\n")+ subprocess.run(["git", "add", "-A"], cwd=tmp_path, check=True)++ assert security_audit.pnpm_install_roots(tmp_path) == [".", "apps/mobile"]++ def test_pnpm_refuses_a_tree_with_no_install_root_at_all(self, tmp_path: Path):+ """Zero install roots is not zero workspaces vulnerable."""+ report = run_pnpm_audit(tmp_path, [])++ assert report.unscanned, "a tree with no lockfile anywhere must be a coverage gap"+ assert exit_code_for(report) == 1+def test_python_refuses_a_tree_with_no_manifests(self, tmp_path: Path):report = run_pip_audit(tmp_path, [])