Skip to main content

Detect secrets and sensitive information in your codebase

Project description

Secrets Hunter

PyPI Python

Secrets Hunter is a lightweight, fully autonomous, and dependency-free scanner that detects secrets and sensitive information in your codebase.

The scanner provides a command-line interface (CLI) and is designed for use both locally (as a linter) and in security pipelines (as a security gate).

Features

Findings are detected using a combined regex and entropy approach:

  • Pattern-based detection: Identifies predefined secret formats (API keys, tokens, etc.)
  • Entropy-based detection: Finds high-entropy strings

Each high-entropy finding gets a confidence boost if it is detected in the context of an assignment or key/value pair with keywords, assuming a secret (e.g., API_KEY=..., "secret_token": "...", etc.).

All of these patterns are fully configurable via TOML config overlays (see Configuration).

Secrets Hunter supports parallel scanning with configurable workers. Output findings can be displayed in console output or exported to a JSON file.

Installation

Requirements: Python 3.11+

Secrets Hunter can be installed via PyPI, from source, or using Docker. For a quick start, install directly from PyPI:

pip install secrets-hunter

For installation from source or Docker, see the Installation docs.

Quick start

Scan the current directory:

secrets-hunter .

Findings are masked by default. To reveal them, use the --reveal-findings flag:

secrets-hunter . --reveal-findings

Scan a specific file:

secrets-hunter path/to/file.py

Export results to JSON:

secrets-hunter . --json results.json

See the Usage docs for all flags and more examples.

Configuration

Secrets Hunter ships with built-in packaged defaults. You can display them using CLI:

secrets-hunter showconfig

Configuration can be customized using overlay config files. Example (team baseline overlay):

secrets-hunter . --config team.toml

Multiple overlays are applied in the order provided:

secrets-hunter . --config ci.toml --config local.toml

A full description and usage examples are available in Configuration docs.

License

Secrets Hunter is released under the MIT License, meaning you are free to use, modify, and distribute it for both personal and commercial purposes.

Acknowledgments

This project was made possible by whitespots.io.

Special thanks to @Shandriuk for implementing the end-to-end functional testing suite.

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

secrets_hunter-0.6.0.tar.gz (326.5 kB view details)

Uploaded Source

Built Distribution

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

secrets_hunter-0.6.0-py3-none-any.whl (334.6 kB view details)

Uploaded Python 3

File details

Details for the file secrets_hunter-0.6.0.tar.gz.

File metadata

  • Download URL: secrets_hunter-0.6.0.tar.gz
  • Upload date:
  • Size: 326.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for secrets_hunter-0.6.0.tar.gz
Algorithm Hash digest
SHA256 610e1a8ba2746fe071ccd2bffba41a19188516ccdac9b30561a617b90e7aa43f
MD5 0d701d987251692967c94d03df91ff30
BLAKE2b-256 757740ed58362ac4bd6b75b9d359977e06505cc7d96942671ff633bb7245f7e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for secrets_hunter-0.6.0.tar.gz:

Publisher: pypi.yml on FVLCN/secrets-hunter

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

File details

Details for the file secrets_hunter-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: secrets_hunter-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 334.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for secrets_hunter-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb5d68549871fccd354cf3b832576113aab2006d3531c4869dccec1a92311545
MD5 dae2e68067c61cae9ed1b9a223735985
BLAKE2b-256 f322225e0aeb5b56f3ca795b62c1b8c8a59bfc0ab7b4abdac45207b30b3f4342

See more details on using hashes here.

Provenance

The following attestation bundles were made for secrets_hunter-0.6.0-py3-none-any.whl:

Publisher: pypi.yml on FVLCN/secrets-hunter

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