Skip to content

ci: Add Gitleaks pre-commit hook for detecting potential credentials #1153

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

Merged
merged 1 commit into from
Aug 8, 2025

Conversation

wajidzahoor-dls
Copy link
Contributor

Instructions to reviewer on how to test:

  1. Pull this branch and verify that pre-commit hooks are active.
    Run the following command to confirm gitleaks is correctly set up:

    pre-commit run --all-files
    

    This should include output from gitleaks, detecting potential hardcoded secrets.

    Note: It is assumed that the CI environment handles installing gitleaks as part of the pre-commit configuration.
    For local testing, the following setup was used:

    python3 -m venv .venv
    source .venv/bin/activate
    pip install pre-commit
    pre-commit install --hook-type pre-commit
    pre-commit run --all-files
    
  2. Test gitleaks manually by attempting to commit a file containing a fake secret (e.g., a fake API key or private key).
    The commit should be blocked by gitleaks if the secret is detected. Note that detection may include false positives or occasionally miss some secrets (false negatives).

    For more information, including configuration options for customizing detection rules, refer to the official documentation:
    https://github.com/gitleaks/gitleaks

Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.49%. Comparing base (41c09c6) to head (b688f47).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1153   +/-   ##
=======================================
  Coverage   94.49%   94.49%           
=======================================
  Files          41       41           
  Lines        2544     2544           
=======================================
  Hits         2404     2404           
  Misses        140      140           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DiamondJoseph DiamondJoseph changed the title Gitleaks pre-commit hook for detecting potential credentials ci: Add Gitleaks pre-commit hook for detecting potential credentials Aug 8, 2025
@DiamondJoseph DiamondJoseph merged commit 3a3335c into main Aug 8, 2025
19 of 20 checks passed
@DiamondJoseph DiamondJoseph deleted the gitleaks_precommit branch August 8, 2025 09:33
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.

2 participants