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


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-cli

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. 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
- 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.

Development

python -m unittest discover -s tests -v

Roadmap

  • Pre-commit framework integration (pre-commit-hooks.yaml)
  • Editor/CI extensions (GitHub Action, Visual Studio Code, pre-commit)
  • 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.0.tar.gz (13.9 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.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file secret_guard_scan-0.1.0.tar.gz.

File metadata

  • Download URL: secret_guard_scan-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for secret_guard_scan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3048a7e72ab5c3815ce27f08e6c36ee5138ea817bfedf7c224e8e8aa7c4fcaeb
MD5 8e46716333ad95f1d340927a06f03405
BLAKE2b-256 f97ab144858695b306d4f6d97c1ea21d3c6da66500ca2e24e81ec8ed0b3a1e2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for secret_guard_scan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1420b545fe89593ded0a272119eebbf9ac471bb8527956ff6b1f72ef653d145d
MD5 ce338ed6774fe76016426e3a18cdee27
BLAKE2b-256 56ab098323217b45013387369d31870ccdefb8f04948a587a7546ed0221038f3

See more details on using hashes here.

Supported by

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