SecretGuard 🔐
Stop leaking API keys before they cost you.
In 2025, 28.6 million hardcoded secrets were exposed on GitHub — a 34% YoY increase. AI coding assistants make it 2× worse. SecretGuard blocks secrets at commit time.
$ secretguard scan .
config/settings.py:12
Rule : [OAI001] OpenAI API Key (legacy)
Severity : 🔴 CRITICAL
Match : sk-aB************lmn
Line : OPENAI_API_KEY = "sk-aBcDe..."
Found 1 secret(s) in 43 file(s) scanned
1 CRITICAL
Install
pip install secretguard
Usage
# Scan current directory
secretguard scan .
# Scan specific file
secretguard scan src/config.py
# Git pre-commit hook (blocks commits with CRITICAL secrets)
secretguard install
# JSON output (CI/CD integration)
secretguard scan . --format json
# HTML report
secretguard scan . --format html --output report.html
# Only fail on HIGH or above
secretguard scan . --fail-on high
# List all 50+ detection rules
secretguard list-rules
What it detects
50+ patterns across all major providers:
| Provider | Rules |
|---|---|
| AWS | Access Key ID, Secret Access Key, MWS Key |
| OpenAI | Legacy key, Project key, Service account |
| Anthropic/Claude | API Key |
| GitHub | PAT (classic + fine-grained), OAuth, Actions tokens |
| Stripe | Live/test secret keys, restricted keys, webhook secrets |
| Slack | Bot token, user token, app token, webhook URL |
| API Key, OAuth token | |
| HuggingFace | API Token |
| SendGrid | API Key |
| Azure | Storage connection string, subscription key |
| Private keys | RSA, OpenSSH, EC, PGP |
| Generic | API key assignments, hardcoded passwords, DB URLs with creds |
| + more | Replicate, DeepSeek, Twilio, Mailgun, npm, Docker Hub, Firebase, Telegram, Supabase |
Git pre-commit hook
# Install (one-time per repo)
secretguard install
# Now every git commit is checked automatically:
# git commit -m "feat: add payment"
# → SecretGuard scans staged files
# → Blocks commit if CRITICAL secrets found
# → Shows exactly where secrets are
# Remove
secretguard uninstall
pre-commit framework
Add to .pre-commit-config.yaml:
repos:
- repo: https://github.com/your-handle/secretguard
rev: v0.1.0
hooks:
- id: secretguard
CI/CD integration
# GitHub Actions
- name: Scan for secrets
run: |
pip install secretguard
secretguard scan . --format json --fail-on high
Options
| Flag | Default | Description |
|---|---|---|
--staged |
false | Scan only git staged files |
--format |
terminal | Output: terminal, json, html |
--output |
— | Output file (for --format html) |
--fail-on |
critical | Exit 1 when: critical, high, medium, low, any, none |
--no-color |
false | Disable ANSI colors |
Why not GitGuardian or GitHub Advanced Security?
- GitGuardian: Enterprise pricing ($$$), sends your code to their servers
- GitHub Advanced Security: Enterprise plans only (~$49/seat/month)
- SecretGuard: Free, open source, fully local — your code never leaves your machine
License
MIT
Metadata
Release files for secretguard 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| secretguard-0.1.0.tar.gz | 15.4 kB | Without provenance | Details for secretguard-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| secretguard-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for secretguard-0.1.0-py3-none-any.whl |
Total release size: 28.9 kB
Release files / secretguard-0.1.0.tar.gz
| Download URL | secretguard-0.1.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
469cb12521f9218dd69f7009d2f60be2a9cbb2f5905e516527301bdc433d0b07
|
|
BLAKE2b-256 checksum How to use checksums |
871741ea41df5b3d68ced02516e04a8c5d510c9630b848509eac4596ca8aa307
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / secretguard-0.1.0-py3-none-any.whl
| Download URL | secretguard-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
700b31a207c83d113fdded9b23e5cd59154ba25e57578039b9ab7d0f8b27aca4
|
|
BLAKE2b-256 checksum How to use checksums |
f733b2f2c0205716d1b55a2e58513b8bd559528023873f28a859d3b9df86920a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Security for secretguard 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.