Detect and redact secrets in key-value pairs, dicts, and environment variables.
Project description
secretscreen
Detect and redact secrets in key-value pairs, dicts, and environment variables.
Best-effort defense-in-depth. Not a security boundary.
Install
pip install secretscreen
Quick start
from secretscreen import redact_pair, redact_dict, audit_dict, Mode
# Single pair
redact_pair("DB_PASSWORD", "hunter2") # → "[REDACTED]"
redact_pair("APP_NAME", "myapp") # → "myapp"
# Dict with recursion
redact_dict({"db": {"password": "x", "host": "localhost"}})
# → {"db": {"password": "[REDACTED]", "host": "localhost"}}
# Aggressive mode (adds entropy detection)
redact_dict(env, mode=Mode.AGGRESSIVE)
# Audit mode (structured findings, no mutation)
findings = audit_dict(env)
# → [Finding(key="DB_PASSWORD", reason="key_pattern:password", ...)]
# Custom safe suffixes (keys ending with these are never redacted)
redact_dict(env, safe_suffixes=("_config", "_enabled"))
Detection layers
- Key-name denylist — substring match against ~30 known secret key patterns
- Structured value parsing — JSON, Python literals, DSN, INI, URL query params
- Value-format detection — 222 known formats via vendored gitleaks patterns (MIT)
- URL credential detection — partial redaction of
user:pass@hostURLs - Entropy detection — Shannon entropy for machine-generated strings (aggressive mode only)
License
MIT. Gitleaks patterns are also MIT-licensed.
Project details
Release history Release notifications | RSS feed
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 secretscreen-0.1.0.tar.gz.
File metadata
- Download URL: secretscreen-0.1.0.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c1fb9c32eea739d64920d5684e22214d1e912c0a6fff126999b02a88749aa9e
|
|
| MD5 |
180ecdbce61ce5fc5fabf4114bfea6b4
|
|
| BLAKE2b-256 |
a10a28e4a293dafd11bcc9d5451f3cefdac10b5c1d3785fa34ee6c935fb09fc7
|
Provenance
The following attestation bundles were made for secretscreen-0.1.0.tar.gz:
Publisher:
publish.yml on featurecreep-cron/secretscreen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secretscreen-0.1.0.tar.gz -
Subject digest:
5c1fb9c32eea739d64920d5684e22214d1e912c0a6fff126999b02a88749aa9e - Sigstore transparency entry: 1105938674
- Sigstore integration time:
-
Permalink:
featurecreep-cron/secretscreen@0007635fbb87db6f067a9767f1c47786bda905e0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/featurecreep-cron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0007635fbb87db6f067a9767f1c47786bda905e0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file secretscreen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: secretscreen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af89b7bb10553a6cd61d7fe4562c07a22fa3a5ba181c23b5226a0eb52e21996c
|
|
| MD5 |
1bd01b079d9a1802de865ea622b41178
|
|
| BLAKE2b-256 |
86e182d90a1566f23a99d254e5680167ecceb111684d283fc58181a904877ec3
|
Provenance
The following attestation bundles were made for secretscreen-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on featurecreep-cron/secretscreen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secretscreen-0.1.0-py3-none-any.whl -
Subject digest:
af89b7bb10553a6cd61d7fe4562c07a22fa3a5ba181c23b5226a0eb52e21996c - Sigstore transparency entry: 1105938689
- Sigstore integration time:
-
Permalink:
featurecreep-cron/secretscreen@0007635fbb87db6f067a9767f1c47786bda905e0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/featurecreep-cron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0007635fbb87db6f067a9767f1c47786bda905e0 -
Trigger Event:
release
-
Statement type: