Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ci): grant the security permissions in dry-run.yml, and derive the caller list

Martin Vogel09c0e88a6484
diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.yml
index 43a6b6bd9..4cf2ec46c 100644
--- a/.github/workflows/dry-run.yml
+++ b/.github/workflows/dry-run.yml
@@ -58,6 +58,13 @@ jobs:
# ── Security (independent island — does not block main pipeline) ──
security:
uses: ./.github/workflows/_security.yml
+ # The called job requests security-events:read to count code-scanning
+ # alerts; a reusable workflow cannot request more than its caller grants,
+ # so withholding this here fails the whole run at startup.
+ permissions:
+ contents: read
+ security-events: read
+ actions: read
secrets: inherit
# ── Lint (cppcheck + clang-format) ────────────────────────────
diff --git a/tests/test_security_gate_fail_closed.sh b/tests/test_security_gate_fail_closed.sh
index 114c16e5e..0e79f2356 100644
--- a/tests/test_security_gate_fail_closed.sh
+++ b/tests/test_security_gate_fail_closed.sh
@@ -98,8 +98,25 @@ require(
# downgrade, it fails the entire run with a startup_failure before a single
# job executes. Checking only the called workflow is how this test passed
# while the PR pipeline never started.
-for caller_name in ("pr.yml", "release.yml"):
- caller = (root / ".github" / "workflows" / caller_name).read_text(encoding="utf-8")
+# The caller list is DERIVED, never hardcoded. An earlier revision listed
+# ("pr.yml", "release.yml") by hand and stayed green while dry-run.yml -- a
+# third caller nobody had listed -- failed every run at startup. A test that
+# only checks the callers you remembered cannot catch the one you forgot.
+workflow_dir = root / ".github" / "workflows"
+callers = sorted(
+ path.name
+ for path in workflow_dir.glob("*.yml")
+ if "uses: ./.github/workflows/_security.yml" in path.read_text(encoding="utf-8")
+)
+require(
+ len(callers) >= 3,
+ "expected at least 3 callers of _security.yml, found: "
+ + (", ".join(callers) or "none")
+ + " -- if a caller was deliberately removed, lower this floor on purpose",
+)
+
+for caller_name in callers:
+ caller = (workflow_dir / caller_name).read_text(encoding="utf-8")
# The next sibling may be a comment line, not a key, so the lookahead has to
# accept any 2-space-indented non-space -- matching only ` \w` silently
# failed to find release.yml's job at all.