EnvGuard scans your code for leaked secrets, credentials, API keys, and .env file contents before they reach git. It uses regex-based pattern matching against 50+ secret formats from 20+ services, lefthook for git hook integration, and produces SARIF-compatible reports for compliance workflows.
envguard scan [file|directory]
One-shot secret scan of files or directories.
How to execute:
bash "<SKILL_DIR>/scripts/envguard.sh" scan [target]
What it does:
Example usage scenarios:
envguard scan .
envguard scan src/config.ts
envguard scan src/
envguard hooks install
Install git pre-commit hooks that scan staged files for secrets before every commit.
How to execute:
bash "<SKILL_DIR>/scripts/envguard.sh" hooks install
What it does:
envguard hooks uninstall
Remove EnvGuard git hooks.
bash "<SKILL_DIR>/scripts/envguard.sh" hooks uninstall
envguard allowlist [add|remove|list] [pattern]
Manage false positive patterns. Allowlisted patterns are skipped during scanning.
bash "<SKILL_DIR>/scripts/envguard.sh" allowlist add "EXAMPLE_API_KEY_FOR_TESTS"
bash "<SKILL_DIR>/scripts/envguard.sh" allowlist remove "EXAMPLE_API_KEY_FOR_TESTS"
bash "<SKILL_DIR>/scripts/envguard.sh" allowlist list
What it does:
envguard diff
Scan only staged changes (git diff --cached) for secrets.
bash "<SKILL_DIR>/scripts/envguard.sh" diff
What it does:
git diff --cached
envguard history [directory]
Full git history scan -- finds secrets in all previous commits.
bash "<SKILL_DIR>/scripts/envguard.sh" history [directory]
What it does:
git log -p
envguard report [directory]
Generate a SARIF-compatible or markdown compliance report.
bash "<SKILL_DIR>/scripts/envguard.sh" report [directory]
What it does:
envguard policy [directory]
Custom secret patterns and enforcement rules.
bash "<SKILL_DIR>/scripts/envguard.sh" policy [directory]
What it does:
EnvGuard detects 50+ secret patterns across 20+ services:
| Category | Examples | Severity |
|----------|----------|----------|
| AWS Credentials | AKIA* keys, aws_secret_access_key | Critical |
| Stripe Keys | sk_live_, sk_test_, rk_live_, whsec_ | Critical |
| GitHub Tokens | ghp_, gho_, ghu_, ghs_, ghr_* | Critical |
| GitLab Tokens | glpat-* | Critical |
| Private Keys | RSA, OPENSSH, DSA, EC, PGP private keys | Critical |
| Slack Tokens | xoxb-, xoxp-, xoxo-, xapp- | High |
| Google API Keys | AIza* | High |
| JWT Tokens | eyJ* (long base64 tokens) | High |
| Database URIs | postgres://, mysql://, mongodb://, redis:// | High |
| Twilio Keys | SK* account SIDs | High |
| SendGrid Keys | SG.* | High |
| Firebase/Supabase | API keys and service tokens | High |
| npm Tokens | npm_* | High |
| Heroku API Keys | Heroku token patterns | Medium |
| DigitalOcean | dop_v1_, doo_v1_ | Medium |
| Azure Keys | Azure subscription/account keys | Medium |
| Cloudflare | API tokens and keys | Medium |
| Docker Hub | Docker auth tokens | Medium |
| Mailgun/Postmark | API keys | Medium |
| Generic Secrets | api_key=, password=, secret=, token= | Low |
| .env Leaks | KEY=value patterns in source files | Low |
Users can configure EnvGuard in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"envguard": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"severityThreshold": "high",
"allowlist": [],
"customPatterns": [],
"excludePatterns": ["**/node_modules/**", "**/dist/**", "**/.git/**"],
"reportFormat": "markdown"
}
}
}
}
}
hooks install, prompt to install it
The user might say things like:
共 1 个版本