Skip to content

security: add gitleaks pre-commit hook and CI scan#285

Merged
beveradb merged 1 commit intomainfrom
security/sess-20260419-2011-add-gitleaks
Apr 20, 2026
Merged

security: add gitleaks pre-commit hook and CI scan#285
beveradb merged 1 commit intomainfrom
security/sess-20260419-2011-add-gitleaks

Conversation

@beveradb
Copy link
Copy Markdown
Collaborator

Summary

Adds org-wide gitleaks secret-scanning in two layers:

  1. Local pre-commit hook (.githooks/pre-commit) — blocks commits containing potential secrets before they're even created. Enable with git config core.hooksPath .githooks.
  2. CI backstop (.github/workflows/security.yml) — calls the reusable gitleaks workflow in nomadkaraoke/.github, scans every PR and push to main.

Config: .gitleaks.toml extends the default gitleaks rules with a dedicated Discord-webhook rule and an allowlist for known false-positive paths (lockfiles, vendor/, node_modules/, Flutter .dart_tool/, WordPress wp-content/, Python test fixtures, Firebase/GCP client API keys).

Why

Following the 2026-04-17 Discord webhook URL leak — a real webhook URL sat in nomadkaraoke/karaoke-gen's archived setup docs for ~9 months, was scraped, and was used to push malware into the #releases channel.

Existing defenses: GitHub push protection (enabled on all public repos). This PR adds the two missing layers (local pre-commit, CI).

Test plan

  • After merge, create a test commit with a fake Discord webhook URL — the CI job should fail.
  • Run brew install gitleaks && git config core.hooksPath .githooks locally, then attempt the same commit — the pre-commit hook should block it.

@coderabbitai ignore

🤖 Generated with Claude Code

Deploys org-wide secret-leak prevention following the 2026-04-17
Discord webhook URL incident (scraped from public karaoke-gen repo,
used to spam malware in #releases).

Layers:
  - .githooks/pre-commit — gitleaks protect --staged (fail fast)
  - .github/workflows/security.yml — reusable CI scanner
  - .gitleaks.toml — default rules + Discord-webhook rule + FP allowlist
@beveradb beveradb closed this Apr 20, 2026
@beveradb beveradb reopened this Apr 20, 2026
@beveradb beveradb merged commit f510043 into main Apr 20, 2026
22 of 23 checks passed
@beveradb beveradb deleted the security/sess-20260419-2011-add-gitleaks branch April 20, 2026 01:15
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