🛡️ secret-guard
Scan your codebase for leaked secrets before they ever reach your git history.
Zero-dependency · Fast · CI-ready · Git-hook ready
Why secret-guard?
Hardcoding secrets is the single most common — and most dangerous — mistake
developers make. A leaked AWS key, GitHub token, or private key can cost
you money, trust, and hours of damage control. secret-guard catches them in
seconds, right on your own machine or in CI, before the secret goes public.
- 🔒 20+ detection rules: AWS keys, GitHub tokens, Stripe, Slack, Google API keys, JWTs, private keys, credential assignments, and more.
- 🧠 Entropy detection: flags high-entropy strings even when no pattern matches.
- 📁 gitignore-aware: automatically skips
node_modules,.git,venv, and whatever your.gitignorealready covers. - 🚀 Zero dependencies for core scanning. Just
pip installand go. - ⚡ Fast: written in pure Python, no external services.
- 🪝 Git-hook guard: one command protects every future commit.
Install
pip install secret-guard-scan
Or run without installing (Python ≥ 3.8):
python -m secretguard
Quick start
# Scan the current directory
secret-guard scan
# Scan a specific path, show exactly what was found
secret-guard scan ./src
# Machine-readable output for CI / other tools
secret-guard scan --json
# Protect every future commit
cd your-repo
secret-guard install-hook
Example output
config.py:12 [HIGH ] GitHub Token: ghp_**************
.env:4 [CRITICAL] Private Key: -----BEGIN [REDACTED]-----
app.py:40 [MEDIUM ] Credential Assignment: password = 'hunter 2'
1 critical, 1 high, 1 medium, 0 low — 3 total
Secret values are masked by default in both the console report and the
--json output. Use --show-value only when you need the full value (e.g. to
rotate the key you just found).
Usage
$ secret-guard scan [path] [options]
Options:
--exclude DIR Skip additional directory names (repeatable)
--no-entropy Disable high-entropy string detection
--json Output findings as JSON
--show-value Print full secret values (default: masked)
--staged Scan only files staged for commit
Exit codes
0— no secrets found (or help/version)1— at least one secret detected
Use this in CI:
- run: pip install secret-guard-scan
- run: secret-guard scan .
Why this project matters
Every week, thousands of secrets leak into public repos. Tools like this one turn "oops, I pushed my key" from a weekly occurrence into a rare event. By using and contributing to secret-guard, you actively make the ecosystem safer.
Star the repo ⭐
If secret-guard helps you, starring the repo is the fastest way to help other developers find it. It's free, takes one click, and keeps the project alive.
Contributing
We welcome contributions of any size, including new detection rules, editor integrations, and docs. See CONTRIBUTING to get started. Please also read our Code of Conduct and Security Policy.
Development
python -m unittest discover -s tests -v
Roadmap
- Pre-commit framework integration (
pre-commit-hooks.yaml,.pre-commit-config.yaml) - Editor/CI extensions (GitHub Actions for tests, lint, and secret scan)
- SARIF output for GitHub code scanning
- More languages & custom-rule manifests
- Baseline / allowlist support
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secret_guard_scan-0.1.1.tar.gz.
File metadata
- Download URL: secret_guard_scan-0.1.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec3ea91be1e77c28e3902b8bc6e4620597a4e0987d6fa14d685c32794c7a72f
|
|
| MD5 |
c12d135d062146912cc9904539a03819
|
|
| BLAKE2b-256 |
5af76f4db49b508b8fdbe5ce613c8a81331f7c38ba1be9f645a10a2b676861fd
|
Provenance
The following attestation bundles were made for secret_guard_scan-0.1.1.tar.gz:
Publisher:
publish.yml on taksh1507/secret-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secret_guard_scan-0.1.1.tar.gz -
Subject digest:
9ec3ea91be1e77c28e3902b8bc6e4620597a4e0987d6fa14d685c32794c7a72f - Sigstore transparency entry: 2490505301
- Sigstore integration time:
-
Permalink:
taksh1507/secret-guard@fa5bc349e5dbf1e18f6059333e79bc60a9763d18 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/taksh1507
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa5bc349e5dbf1e18f6059333e79bc60a9763d18 -
Trigger Event:
push
-
Statement type:
File details
Details for the file secret_guard_scan-0.1.1-py3-none-any.whl.
File metadata
- Download URL: secret_guard_scan-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
061e4d55ce929f2c130856699ba4eb61c2d8f495b72b8da3b321a4ac448d5a2c
|
|
| MD5 |
1fe1a914e254521e849f5f161879d176
|
|
| BLAKE2b-256 |
cae9fb437bd1956225a4616a15cd5112644d1e1b5a9cc11ead45e8c1b5f0e94a
|
Provenance
The following attestation bundles were made for secret_guard_scan-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on taksh1507/secret-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secret_guard_scan-0.1.1-py3-none-any.whl -
Subject digest:
061e4d55ce929f2c130856699ba4eb61c2d8f495b72b8da3b321a4ac448d5a2c - Sigstore transparency entry: 2490505830
- Sigstore integration time:
-
Permalink:
taksh1507/secret-guard@fa5bc349e5dbf1e18f6059333e79bc60a9763d18 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/taksh1507
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa5bc349e5dbf1e18f6059333e79bc60a9763d18 -
Trigger Event:
push
-
Statement type: