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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Run the gate self-test and provenance audit in the security workflow
Martin Vogel1b383e376acb
diff --git a/.github/workflows/_security.yml b/.github/workflows/_security.ymlindex 07b4a77ac..ce32a6114 100644--- a/.github/workflows/_security.yml+++ b/.github/workflows/_security.yml@@ -24,13 +24,19 @@ jobs:license-gate:runs-on: ubuntu-latest- timeout-minutes: 15+ timeout-minutes: 30steps:- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3- name: Install ScanCode Toolkitrun: pipx install scancode-toolkit+ - name: "Gate self-test (a planted violation must be detected)"+ run: scripts/license-gate.sh --selftest- name: "License compliance gate (one finding fails)"run: scripts/license-gate.sh+ - name: "License provenance audit (byte-identity vs upstream)"+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: scripts/audit-license-provenance.pycodeql-gate:runs-on: ubuntu-latestdiff --git a/scripts/audit-license-provenance.py b/scripts/audit-license-provenance.pyindex f469a231c..5e9591c25 100755--- a/scripts/audit-license-provenance.py+++ b/scripts/audit-license-provenance.py@@ -213,6 +213,14 @@ def main():open("/tmp/audit_licenses_results.json", "w"), indent=1)print("\nfull results: /tmp/audit_licenses_results.json")+ accepted = {"IDENTICAL", "IDENTICAL@PINNED", "FIRST-PARTY-OK",+ "FIRST-PARTY-NOTICE", "MANUAL-VERIFIED"}+ bad = {k: v for k, v in results.items() if v[0] not in accepted}+ if bad:+ print(f"\nPROVENANCE AUDIT FAILED: {len(bad)} unexplained verdict(s)")+ sys.exit(1)+ print("\nPROVENANCE AUDIT PASSED: every vendored license accounted for")+if __name__ == "__main__":main()diff --git a/scripts/license-gate.sh b/scripts/license-gate.shindex 99b608937..723e5826b 100755--- a/scripts/license-gate.sh+++ b/scripts/license-gate.sh@@ -18,6 +18,24 @@ set -euo pipefailROOT="$(cd "$(dirname "$0")/.." && pwd)"cd "$ROOT"+# --selftest: plant a violation and assert the structural layer catches it.+# Run in CI before the real gate so a silently-broken gate cannot pass.+if [ "${1:-}" = "--selftest" ]; then+ TESTDIR="$ROOT/vendored/.gate-selftest-$$"+ mkdir -p "$TESTDIR"+ echo "int x;" > "$TESTDIR/x.c"+ # The child gate exits 1 on the planted violation (that is the point) —+ # capture its output first so pipefail cannot mask the grep result.+ GATE_OUT="$("$0" 2>/dev/null || true)"+ rm -rf "$TESTDIR"+ if printf '%s' "$GATE_OUT" | grep -q "BLOCKED: vendored code in .*gate-selftest"; then+ echo "OK: gate self-test — planted violation was detected"+ exit 0+ fi+ echo "FAIL: gate self-test — planted unlicensed file was NOT detected"+ exit 1+fi+echo "=== License gate 1/2: structural coverage ==="# Rule: every directory under either vendored tree that contains source or# data files must have a license file in itself or an ancestor directory