Skip to content

Commit 3a3335c

Browse files
ci: Add Gitleaks pre-commit hook for detecting potential credentials (#1153)
### 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
1 parent 41c09c6 commit 3a3335c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ repos:
3131
args:
3232
# Make the tool search for charts only under the `helm` directory
3333
- --chart-search-root=helm
34+
35+
- repo: https://github.com/gitleaks/gitleaks
36+
rev: v8.28.0
37+
hooks:
38+
- id: gitleaks

0 commit comments

Comments
 (0)