Agent skill
gitleaks
Scan repository for hardcoded secrets and credentials
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/gitleaks
SKILL.md
Secret Detection with Gitleaks
Scan the repository for hardcoded secrets, API keys, tokens, and credentials using gitleaks patterns.
What To Do
-
Check if gitleaks is installed:
- Run:
gitleaks versionor install viachoco install gitleaks/brew install gitleaks - Alternative: Use regex patterns manually if gitleaks CLI not available
- Run:
-
Run full repository scan:
bashgitleaks detect --source=. --report-format=json --report-path=gitleaks-report.json -
Run pre-commit scan (staged files only):
bashgitleaks protect --staged --report-format=json -
Common secret patterns to detect:
- AWS:
AKIA[0-9A-Z]{16} - Azure:
AccountKey=[A-Za-z0-9+/=]{86}== - GitHub:
gh[ps]_[A-Za-z0-9_]{36} - JWT:
eyJ[A-Za-z0-9_-]*\.eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]* - Connection strings:
(Server|Data Source|mongodb|redis).*?(Password|pwd)= - Private keys:
-----BEGIN (RSA |EC )?PRIVATE KEY-----
- AWS:
-
If secrets found:
- Rotate the compromised credential IMMEDIATELY
- Remove from code and use environment variables or Azure Key Vault
- Add pattern to
.gitignoreand.gitleaksignore - Use
git filter-repoto purge from history if already committed
-
Configure .gitleaks.toml for custom rules:
toml[extend] useDefault = true [[rules]] id = "cosmos-connection-string" description = "CosmosDB Connection String" regex = '''AccountEndpoint=https://[^;]+;AccountKey=[A-Za-z0-9+/=]+''' tags = ["azure", "cosmosdb"] [allowlist] paths = ["**/*test*", "**/*mock*", "**/appsettings.Development.json"] -
CI/CD Integration:
yaml# Azure Pipelines - script: | gitleaks detect --source=. --report-format=sarif --report-path=gitleaks.sarif displayName: "Secret Scan"
Arguments
--path=<dir>: Directory to scan (default: current repo)--verbose: Show all findings with file paths and line numbers
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?