Skip to main content

🛡️ secret-guard

Scan your codebase for leaked secrets before they ever reach your git history.

Zero-dependency · Fast · CI-ready · Git-hook ready

CI secret-guard scan PyPI - Version PyPI - Python License: MIT


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 .gitignore already covers.
  • 🚀 Zero dependencies for core scanning. Just pip install and 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

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secret_guard_scan-0.1.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secret_guard_scan-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

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

Hashes for secret_guard_scan-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ec3ea91be1e77c28e3902b8bc6e4620597a4e0987d6fa14d685c32794c7a72f
MD5 c12d135d062146912cc9904539a03819
BLAKE2b-256 5af76f4db49b508b8fdbe5ce613c8a81331f7c38ba1be9f645a10a2b676861fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for secret_guard_scan-0.1.1.tar.gz:

Publisher: publish.yml on taksh1507/secret-guard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secret_guard_scan-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for secret_guard_scan-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 061e4d55ce929f2c130856699ba4eb61c2d8f495b72b8da3b321a4ac448d5a2c
MD5 1fe1a914e254521e849f5f161879d176
BLAKE2b-256 cae9fb437bd1956225a4616a15cd5112644d1e1b5a9cc11ead45e8c1b5f0e94a

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page