Skip to content

chore(security): add gitleaks pre-commit + CI secret scan (LAC-2555) - #34

Open
lacymorrow wants to merge 1 commit into
mainfrom
lac-2555-secret-scanner
Open

chore(security): add gitleaks pre-commit + CI secret scan (LAC-2555)#34
lacymorrow wants to merge 1 commit into
mainfrom
lac-2555-secret-scanner

Conversation

@lacymorrow

Copy link
Copy Markdown
Contributor

Summary

Adds a two-layer secret scanner per LAC-2555 (Paperclip): CI-side gate + local pre-commit hook. Follows LAC-2548, where a plaintext OpenAI key made it into the repo.

  • CI gate: .github/workflows/gitleaks.yml runs gitleaks-action on every PR and every push to main. Fails the check if a plaintext credential appears in the diff.
  • Local hook: .githooks/pre-commit runs gitleaks protect --staged when the binary is installed. Graceful skip + warning if not — CI still catches it either way.
  • Auto-wiring: postinstall sets git config core.hooksPath .githooks so the hook activates on the next install without adding a new devDependency.
  • Config: .gitleaks.toml extends the default rule set and allowlists placeholder-credential files (.env.example*, docs/, LLM crawl fixtures) so we don't false-positive.

Scope kept tight per Rule 28 — no refactors, no other changes.

Test plan

  • CI job "gitleaks" appears on this PR and passes (nothing sensitive in the diff).
  • After merge, git config core.hooksPath reads .githooks after pnpm install / bun install.
  • Manual leak test: echo "AWS_SECRET_ACCESS_KEY=AKIA...redacted" > /tmp/leak.txt && git add /tmp/leak.txt && git commit -m test should fail locally (if gitleaks installed) or on CI.

Refs: LAC-2555, LAC-2548, LAC-2554 (credential rotation, tracked separately).

Defense-in-depth to prevent plaintext credentials from reaching the repo.

- `.github/workflows/gitleaks.yml` — Gitleaks Action on every PR/main push.
- `.gitleaks.toml` — extends default rules; allowlists example env files,
  docs, and generated LLM crawl fixtures.
- `.githooks/pre-commit` — local scan of staged changes when gitleaks is
  installed; graceful skip + warning otherwise (CI still runs).
- `package.json` postinstall wires `core.hooksPath` to `.githooks/` on
  every install so the hook auto-activates without a new devDependency.

If a real secret is caught: rotate first, then remove from the diff
(knowledge/agent-common.md → Secret handling).
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bones Ready Ready Preview, Comment Jul 6, 2026 5:11am

Request Review

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Failed to generate code suggestions for PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant