chore(security): add gitleaks pre-commit + CI secret scan (LAC-2555) - #34
Open
lacymorrow wants to merge 1 commit into
Open
chore(security): add gitleaks pre-commit + CI secret scan (LAC-2555)#34lacymorrow wants to merge 1 commit into
lacymorrow wants to merge 1 commit into
Conversation
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).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Failed to generate code suggestions for PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
.github/workflows/gitleaks.ymlruns gitleaks-action on every PR and every push tomain. Fails the check if a plaintext credential appears in the diff..githooks/pre-commitrunsgitleaks protect --stagedwhen the binary is installed. Graceful skip + warning if not — CI still catches it either way.postinstallsetsgit config core.hooksPath .githooksso the hook activates on the next install without adding a new devDependency..gitleaks.tomlextends 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
git config core.hooksPathreads.githooksafterpnpm install/bun install.echo "AWS_SECRET_ACCESS_KEY=AKIA...redacted" > /tmp/leak.txt && git add /tmp/leak.txt && git commit -m testshould fail locally (if gitleaks installed) or on CI.Refs: LAC-2555, LAC-2548, LAC-2554 (credential rotation, tracked separately).