Scan repository for hardcoded secrets and credentials
Scan the repository for hardcoded secrets, API keys, tokens, and credentials using gitleaks patterns.
Check if gitleaks is installed:
gitleaks version or install via choco install gitleaks / brew install gitleaksRun full repository scan:
gitleaks detect --source=. --report-format=json --report-path=gitleaks-report.json
Run pre-commit scan (staged files only):
gitleaks protect --staged --report-format=json
Common secret patterns to detect:
AKIA[0-9A-Z]{16}AccountKey=[A-Za-z0-9+/=]{86}==gh[ps]_[A-Za-z0-9_]{36}eyJ[A-Za-z0-9_-]*\.eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*(Server|Data Source|mongodb|redis).*?(Password|pwd)=-----BEGIN (RSA |EC )?PRIVATE KEY-----If secrets found:
.gitignore and .gitleaksignoregit filter-repo to purge from history if already committedConfigure .gitleaks.toml for custom rules:
[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:
# Azure Pipelines
- script: |
gitleaks detect --source=. --report-format=sarif --report-path=gitleaks.sarif
displayName: "Secret Scan"
--path=<dir>: Directory to scan (default: current repo)--verbose: Show all findings with file paths and line numbersSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer
Tags:security, secrets, devsecops, pre-commit