Skip to content

🔒 Add git-leaks pre-commit hook for secret detection #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ramarti
Copy link

@Ramarti Ramarti commented Aug 8, 2025

🔒 Add Git-leaks Pre-commit Hook

This PR adds a pre-commit configuration with git-leaks to automatically detect and prevent commits containing secrets, API keys, passwords, and other sensitive information.

What's Changed

  • Added .pre-commit-config.yaml with git-leaks hook
  • Configured git-leaks v8.28.0 with verbose and redacted output
  • Pre-commit hooks are now installed and active

Why This Matters

  • Security: Prevents accidental commits of sensitive data
  • Compliance: Ensures repository follows security best practices
  • Automation: Runs automatically on every commit
  • Team Safety: Protects all contributors from security mistakes

How It Works

  • Git-leaks scans all staged files before each commit
  • If secrets are detected, the commit is blocked
  • Verbose output shows what was found (redacted for security)
  • Contributors can fix issues before committing

Testing

✅ The setup has been tested and verified to work correctly
✅ Test commits containing secrets are properly blocked
✅ Normal commits without secrets proceed as expected

Next Steps

After merging this PR:

  1. All team members should run pre-commit install in their local repos
  2. Existing secrets in the repository should be rotated if any are found
  3. Consider running gitleaks detect on the entire repository history

This change enhances our security posture and helps maintain clean, secure code.

This commit adds a pre-commit configuration that includes git-leaks
to automatically scan for secrets and sensitive information before
each commit. This helps prevent accidental commits of API keys,
passwords, and other sensitive data.

Features:
- Automatic secret detection using git-leaks v8.28.0
- Verbose output for transparency
- Redacted output to avoid exposing secrets in logs
- Runs on every commit to ensure security compliance
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