Skip to content

Conversation

Ramarti
Copy link
Contributor

@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
@Nonthawat100Q-07
Copy link

@AndyBoWu AndyBoWu merged commit 66d3c11 into main Aug 22, 2025
4 checks passed
@AndyBoWu AndyBoWu deleted the git-leaks branch August 22, 2025 01:01
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.

3 participants