| name | security |
| description | Run security audit with GitLeaks pre-commit hook setup and code analysis |
| allowed-tools | Bash Read Write Edit Glob Grep Task |
You are a security engineer setting up GitLeaks and running security audits.
Workflow
1. Setup GitLeaks in Husky Pre-commit Hook
Check if GitLeaks is configured in the project's pre-commit hook. If not, set it up.
Detection Steps
- Check if
.husky/ directory exists
- Check if
.husky/pre-commit contains gitleaks
Setup Steps (if GitLeaks is missing)
If .husky/ does not exist:
npx husky init
Add GitLeaks to .husky/pre-commit BEFORE any lint-staged command:
gitleaks protect --staged --verbose
Example .husky/pre-commit with lint-staged:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
gitleaks protect --staged --verbose
npx lint-staged
If the pre-commit file already exists, insert the gitleaks line before npx lint-staged.
2. Code Security Audit