Block staged secrets with pinned Gitleaks pre-commit hooks #92

Merged
portegumi merged 2 commits from kiyi/gitleaks-pre-commit into main 2026-10-12 16:22:18 -05:00
Member

Commits currently rely on CI to detect new credentials after they have entered history. Add version-controlled native Gitleaks 8.30.1 hooks and a clone-local installer shared by existing and future linked worktrees. The hook scans the actual commit index with full redaction and blocks findings, missing/wrong versions, scanner errors and repository ignore overrides. Document copying and installing the reviewed source before the first commit in a new repository.

Validation: 14 native Git/Gitleaks tests passed, covering initial commits, staged versus unstaged content, commit -a/--only indexes, worktrees, redaction and fail-closed behavior. Shell syntax and diff checks passed. The hook also scanned this commit successfully. Existing Forgejo CI files, scan names, schedules and required checks are unchanged; hosted CI remains pending.

Refs #91.

Commits currently rely on CI to detect new credentials after they have entered history. Add version-controlled native Gitleaks 8.30.1 hooks and a clone-local installer shared by existing and future linked worktrees. The hook scans the actual commit index with full redaction and blocks findings, missing/wrong versions, scanner errors and repository ignore overrides. Document copying and installing the reviewed source before the first commit in a new repository. Validation: 14 native Git/Gitleaks tests passed, covering initial commits, staged versus unstaged content, commit -a/--only indexes, worktrees, redaction and fail-closed behavior. Shell syntax and diff checks passed. The hook also scanned this commit successfully. Existing Forgejo CI files, scan names, schedules and required checks are unchanged; hosted CI remains pending. Refs #91.
Block staged secrets with pinned Gitleaks pre-commit hooks
Some checks failed
Workflow acceptance / acceptance (pull_request) Successful in 1m30s
Repository security / security-1 (pull_request) Failing after 5m26s
Library checks / tests (pull_request) Successful in 5m46s
5ddd1383ca
Member

The hook implementation passed all 14 synthetic local cases when the disposable test directory was isolated from this agent scratch parent Git repository; the four hook source files are byte-identical across all 11 adoption PRs. Hosted acceptance/library tests passed, but source-security run 575 has one generic-api-key blocker from tests/test_terraform_catalog.py:89 in the separate #89 branch detected by the repository-wide all-ref history scan. That test contains a public S3 object-name fixture; #89 and #87 include narrow reviewed false-positive handling, whereas this branch/main policy does not. Land an independently reviewed exact mitigation (without disabling all-ref scans), then rerun #92 security before merge. This reviewer account lacks protected-main merge permission.

The hook implementation passed all 14 synthetic local cases when the disposable test directory was isolated from this agent scratch parent Git repository; the four hook source files are byte-identical across all 11 adoption PRs. Hosted acceptance/library tests passed, but source-security run 575 has one generic-api-key blocker from tests/test_terraform_catalog.py:89 in the separate #89 branch detected by the repository-wide all-ref history scan. That test contains a public S3 object-name fixture; #89 and #87 include narrow reviewed false-positive handling, whereas this branch/main policy does not. Land an independently reviewed exact mitigation (without disabling all-ref scans), then rerun #92 security before merge. This reviewer account lacks protected-main merge permission.
Review exact public Terraform object fixture in all-ref scans
All checks were successful
Repository security / security-1 (pull_request) Successful in 2m52s
Library checks / tests (pull_request) Successful in 3m17s
Workflow acceptance / acceptance (pull_request) Successful in 4m51s
215df31c6c
portegumi approved these changes 2026-10-12 16:22:01 -05:00
portegumi left a comment

Approved exact head 215df31. The four hook files remain the reviewed shared implementation; local hook tests pass 14/14, source-secret tests pass 12/12 with pinned native Gitleaks, and diff checks pass. The new exception is constrained to the public Terraform test object name, exact source path, rule and literal; changed values and adjacent real findings remain blocking, with all-ref history scanning retained. Hosted Repository security run 578 reports 0 blockers, 0 scanner errors, one exact public-object review; library and workflow acceptance checks pass. This is source acceptance, not a deployment.

Approved exact head 215df31. The four hook files remain the reviewed shared implementation; local hook tests pass 14/14, source-secret tests pass 12/12 with pinned native Gitleaks, and diff checks pass. The new exception is constrained to the public Terraform test object name, exact source path, rule and literal; changed values and adjacent real findings remain blocking, with all-ref history scanning retained. Hosted Repository security run 578 reports 0 blockers, 0 scanner errors, one exact public-object review; library and workflow acceptance checks pass. This is source acceptance, not a deployment.
portegumi deleted branch kiyi/gitleaks-pre-commit 2026-10-12 16:22:18 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Homelab/workflows!92
No description provided.