Files
d37233e0c3 security: repo-wide client-identifier leak guard (fail-closed) + pre-commit hook (#65)
The existing hashed-denylist scan lives in lint_skills.py and only covers
skills/**. The identifier leak that motivated this guard landed in README.md
and tests/ — files that linter never sees, and skill-lint.yml only triggers on
skills/** paths anyway. It also fails OPEN: a missing denylist prints a NOTE
and exits 0.

This closes both holes:

- scripts/scan_identifiers.py — standalone scanner reusing the same denylist
  file and 1-/2-word shingle-hash logic, but over EVERY tracked text file
  (git ls-files, minus binaries). Fails CLOSED: missing/empty denylist = exit 2.
- .github/workflows/leak-guard.yml — runs it (and its self-test) on every push
  and PR with NO path filter. contents: read.
- .githooks/pre-commit — same scan locally before push (opt-in via
  `git config core.hooksPath .githooks`).
- scripts/test_scan_identifiers.py — stdlib self-check: catch, clean,
  case-insensitive, and fail-closed behaviors.
- scripts/.identifier-denylist.sha256 — added the single-word hash to
  complement the existing two-word entry (both now covered).
- CONTRIBUTING.md — documents the guard, the hook, and how to ban a new
  identifier without committing the plaintext.

Verified: whole-repo scan 0 matches / exit 0; self-test passes; missing denylist
exits 2; a planted identifier is blocked by both the scanner and the hook;
lint_skills.py still 0 errors. (The guard even caught a client name I'd left in
this scanner's own docstring — removed.)

Scope note: identifier-only by design. Repo-wide secret scanning is deferred —
it would false-positive on the synthetic AKIA test keys in docs/verification/,
which need allowlist work first. Secrets stay covered by lint_skills.py (skills)
and secret_scan.py.

Co-authored-by: Sachin Sharma <elementalsoul@Sachins-MacBook-Pro.local>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 20:27:39 +05:30

30 lines
824 B
YAML

name: leak-guard
# Repo-wide client/engagement-identifier leak guard. Unlike skill-lint.yml (which
# only watches skills/**), this runs on EVERY push and PR with no path filter —
# because the real leak that motivated it landed in README.md and tests/, not skills.
# scan_identifiers.py fails CLOSED if the denylist is missing.
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
scan:
name: Client-identifier scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Self-test the scanner
run: python3 scripts/test_scan_identifiers.py
- name: Scan repo for client identifiers
run: python3 scripts/scan_identifiers.py