EnvWatch is a lightweight Go utility that scans your system for potentially exposed secrets such as API keys, passwords, private keys, and AWS credentials.
It helps developers and security-conscious users quickly identify sensitive data leaks across environment variables, config files, and the filesystem.
- 🔎 Scan environment variables for secrets
- 📁 Detect secrets inside
.envfiles - 🔐 Identify private key files (
.pem,.key, SSH keys) - ☁️ Scan AWS credentials/config files
- 🧠 Entropy-based secret detection (finds hidden/random tokens)
- 🎯 Flexible filtering via CLI flags
- 📊 JSON report generation
- 🎨 Colored terminal output (auto-disabled when piped)
git clone https://github.com/cloudbreach/EnvWatch.git
cd envwatch
go run envwatch.go --helpgo run envwatch.go --help| Flag | Description |
|---|---|
--env |
Scan only .env files |
--keys |
Scan only key files |
--aws |
Scan only AWS credentials |
--no-system |
Skip filesystem scan |
--show-secrets |
Show full secret values |
--partial |
Partially mask secrets |
--help |
Show help menu |
Scan everything:
go run envwatch.go --show-secretsScan only .env files:
go run envwatch.go --envShow partially masked secrets:
go run envwatch.go --partialShow full secrets (
go run envwatch.go --show-secretsEnvWatch uses two main approaches:
It searches for variable names containing common secret-related terms:
PASSWORDSECRETTOKENAPI_KEYPRIVATE_KEY- etc.
It calculates the Shannon entropy of values to detect random-looking strings that may indicate secrets.
-
Environment variables (
os.Environ) -
.envfiles across your home directory -
SSH directory (
~/.ssh) -
AWS credentials:
~/.aws/credentials~/.aws/config
-
Files ending in:
.env.pem.key
- Displays detected secrets grouped by file/source
- Color-coded for readability
A file named:
secret_report.json
Contains:
{
"stats": {
"total_secrets": 10,
"files_scanned": 120,
"by_source": {
"environment": 3,
".env file": 5,
"key file": 2
}
},
"secrets": [
{
"source": "environment",
"file": "system",
"variable": "API_KEY",
"value": "[REDACTED]"
}
]
}- By default, secrets are fully redacted
- Use
--partialor--show-secretswith caution - Avoid sharing generated reports publicly if secrets are exposed
- Git repository scanning
- Ignore/include path filters
- Custom keyword configuration
- Real-time monitoring mode
- Export formats (CSV, HTML)
This project is licensed under the MIT License.
Feel free to create a Pull Request if you have any ideas or features you would like to add.
For a deeper dive into the methodology behind the tool and why securing .env files is critical, check out our full write-up: 🔗 EnvWatch - Find Exposed Secrets Before Hackers Do
See EnvWatch in action. The demonstration below shows how quickly the tool can scan and identify exposed secrets in real-time:

Marios Daskalas, Cloud Security Engineer @ CloudBreach




