Scans your .env files and git history for accidentally committed secrets, API keys, and credentials.
- 39% of GitHub repos have accidentally committed secrets (GitGuardian 2024 report)
.envfiles get committed by mistake all the time- Keys in git history persist even after you delete the file
git clone https://github.com/spinov001-art/env-secrets-checker
cd env-secrets-checker
python checker.py /path/to/your/projectNo dependencies needed. Pure Python 3.
| Check | Description |
|---|---|
.env files |
Scans for API keys, tokens, passwords in .env and .env.* files |
.gitignore |
Verifies .env is in .gitignore |
| Git history | Searches git log for accidentally committed secrets |
| Config files | Checks config.json, settings.py, etc. for hardcoded credentials |
| Docker files | Checks docker-compose.yml and Dockerfile for exposed secrets |
- AWS Access Keys (
AKIA...) - GitHub Tokens (
ghp_,github_pat_) - Stripe Keys (
sk_live_,pk_live_) - Slack Tokens (
xoxb-,xoxp-) - Google API Keys
- JWT Tokens
- Generic passwords, API keys, secrets
- Database connection strings with credentials
=== .env Secrets Checker ===
Scanning: /path/to/project
π .env files:
β
.env is in .gitignore
β οΈ .env.production found β contains 3 secrets
- AWS_SECRET_ACCESS_KEY (line 4)
- STRIPE_SECRET_KEY (line 12)
- DATABASE_URL with password (line 18)
π Git history:
π΄ .env was committed in abc1234 (2024-01-15)
π΄ config.json contained API_KEY in def5678 (2024-02-03)
π Config files:
β οΈ docker-compose.yml has POSTGRES_PASSWORD in plaintext (line 22)
Summary: 5 issues found (2 critical, 3 warnings)
# .github/workflows/secrets-check.yml
- name: Check for secrets
run: python checker.py . --fail-on-critical# .git/hooks/pre-commit
python /path/to/checker.py . --staged-only --fail-on-critical- API Vulnerability Scanner β OWASP API security checks
- npm Typosquat Scanner β npm supply chain security
- Awesome Free APIs β 300+ free APIs
MIT
- GitHub Security Scanner β Scan repos for dependency vulnerabilities
- Git Secrets Audit β Scan git history for leaked credentials