Skip to main content

Detect and redact secrets in key-value pairs, dicts, and environment variables.

Project description

secretscreen

CI Python 3.11+ License: MIT

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

  1. Key-name denylist — substring match against ~30 known secret key patterns
  2. Structured value parsing — JSON, Python literals, DSN, INI, URL query params
  3. Value-format detection — 222 known formats via vendored gitleaks patterns (MIT)
  4. URL credential detection — partial redaction of user:pass@host URLs
  5. Entropy detection — Shannon entropy for machine-generated strings (aggressive mode only)

License

MIT. Gitleaks patterns are also MIT-licensed.

Project details


Download files

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

Source Distribution

secretscreen-0.1.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

secretscreen-0.1.0-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

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

Hashes for secretscreen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c1fb9c32eea739d64920d5684e22214d1e912c0a6fff126999b02a88749aa9e
MD5 180ecdbce61ce5fc5fabf4114bfea6b4
BLAKE2b-256 a10a28e4a293dafd11bcc9d5451f3cefdac10b5c1d3785fa34ee6c935fb09fc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretscreen-0.1.0.tar.gz:

Publisher: publish.yml on featurecreep-cron/secretscreen

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

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

Hashes for secretscreen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af89b7bb10553a6cd61d7fe4562c07a22fa3a5ba181c23b5226a0eb52e21996c
MD5 1bd01b079d9a1802de865ea622b41178
BLAKE2b-256 86e182d90a1566f23a99d254e5680167ecceb111684d283fc58181a904877ec3

See more details on using hashes here.

Provenance

The following attestation bundles were made for secretscreen-0.1.0-py3-none-any.whl:

Publisher: publish.yml on featurecreep-cron/secretscreen

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 Pingdom Monitoring Sentry Error logging StatusPage Status page