Skip to main content

🛡️ SecretShield

Your secrets shouldn't end up in your terminal, your logs, or your commit history.

PyPI version Python versions PyPI Downloads License: MIT

Install · Demo · Try it · Homepage 🌐 · Full usage guide →


You've done this. Everyone has: a stray print() left in from debugging, a log line that dumps a config dict, a hardcoded key that slips past review. SecretShield catches it before it leaves your machine — redacted from your terminal output automatically, scanned out of your codebase on demand, and blocked from your commits if it gets that far.

Demo

SecretShield Demo

▶ Watch the full demo on YouTube

Install

Windows (recommended): download secretshield-windows-x64-setup.exe from the latest release, run it, then open a new terminal and try:

ss --version
ss scan .

No Python needed, no administrator rights. A portable zip is also available, and Linux and macOS get a single-file binary. The builds are not code-signed, so Windows or macOS may show a warning: see the installation guide for checksums, upgrading, uninstalling and troubleshooting.

Python developers:

pip install secretshield

Try it

import secretshield

api_key = "sk-example1234567890abcdefFAKEKEY"
print("API key:", api_key)
API key: ********
⚠ secretshield: Potential secret detected and redacted.

No config, no code changes — the moment you import it, stdout, stderr, and logging are protected.

Scan a project:

secretshield scan .

Set a project up in one step — config file, Git hook, CI workflow:

secretshield init

(Every command also works via the shorter ss alias.)

What it does

🖥️ Runtime protection import secretshield redacts secrets from stdout, stderr, and logging automatically
🔍 Static scanning secretshield scan . finds hardcoded secrets across Python, JS/TS, HTML, YAML, .env, and more
🔧 Auto-Fix scan . --fix moves a hardcoded Python or JS/TS secret into .env and rewrites the code — only when it's unambiguous
🔄 Rotation assistant scan . --rotate walks you through revoking a leaked credential with its provider, replacing it, and checking for leftover copies — it never revokes anything itself
🪝 Git hook install-hook blocks a commit before a secret reaches your history
⚙️ GitHub Actions github-action generates a workflow that scans every push and PR

No required dependencies, no telemetry, no network calls. Everything runs locally, in your own process.

Custom rules

Have a credential format of your own? Drop a .secretshield-rules.toml in your project root:

[[rules]]
name = "My API Key"
pattern = "MYAPP_[A-Za-z0-9]{32}"

secretshield scan . picks it up automatically — no flag needed. The rules file itself is never treated as project content to scan, so a pattern that resembles a real secret won't flag its own definition. Validate rules with secretshield rules check, create one interactively with secretshield rule create, or try a pattern against sample text with secretshield rule test before committing to it.

For the full command reference, configuration options, and exactly how Auto-Fix decides what's safe to rewrite, see the usage guide.

Limitations

Runtime protection covers this Python process's stdout/stderr/ logging — not screenshots, the clipboard, or other applications. Auto-Fix only rewrites Python and JS/TS, and only unambiguous assignments; anything less certain is reported, not modified. Treat SecretShield as a strong safety net, not a replacement for proper secret management. Details in the usage guide.

Contributing

Issues and PRs welcome. Add tests for new detection patterns or behavior changes, use only fake credentials in tests/examples, and run pytest before opening a PR.

☕ Get me a coffee

If you find this project useful, consider supporting its development through GitHub Sponsors.

License

MIT — see LICENSE.

Homepage

Visit the official SecretShield homepage for an overview of the project, features, releases, and more:

🌐 therealsecretshield.freebuff.app

🏆 Recognition

SecretShield was recognised as Best Developer Tool in Waycode's Founding 100.

Waycode's Founding 100 brought together builders and their projects, recognising eight projects across different categories.

This recognition highlights SecretShield's work in open-source security tooling and local-first secret detection.

Read the announcement →

Metadata

Release files for secretshield 0.13.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secretshield 0.13.2
File Size Uploaded Provenance Actions
secretshield-0.13.2.tar.gz 166.6 kB Without provenance Details for secretshield-0.13.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for secretshield 0.13.2
File Interpreter ABI Platform Actions
secretshield-0.13.2-py3-none-any.whl Python 3 none any Details for secretshield-0.13.2-py3-none-any.whl

Total release size: 252.9 kB

Release files / secretshield-0.13.2.tar.gz

Download URL secretshield-0.13.2.tar.gz
Size 166.6 kB
Tags Source
SHA-256 checksum
How to use checksums
374f357c9a11cc9a9808fafafa883640ad3302534654b4d81ac1b15859c9d86a
BLAKE2b-256 checksum
How to use checksums
9770ae828a17c0c70cf9649ad8a2df0298ae3acee01db46136f09b8aec5e50db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / secretshield-0.13.2-py3-none-any.whl

Download URL secretshield-0.13.2-py3-none-any.whl
Size 86.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70e83ab632a11ea89c63a4facf0cbea796d81d4e1230e6e08beddc51948f7785
BLAKE2b-256 checksum
How to use checksums
116638ead7d0fc2f7e46784cea18a1eea62e6c5c6add522bc9fe3c48d854d207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for secretshield 0.13.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page