Skip to main content

Detect secrets and sensitive information in your codebase

Project description

Secrets Hunter

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+

From PyPI

pip install secrets-hunter

From source

  1. Clone this repository
git clone https://github.com/FVLCN/secrets-hunter.git secrets-hunter
cd secrets-hunter
  1. Activate virtual environment (macOS and Linux)
python -m venv venv
source venv/bin/activate
  1. Build and install package
pip install -e .

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 and supports overlay configs.

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 of the configuration are available in Configuration docs.

License

MIT

Acknowledgment

This project was made possible by whitespots.io

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.0.2.tar.gz (18.9 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.0.2-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: secrets_hunter-0.0.2.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for secrets_hunter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 70a712d478fa2965f9d540507616a434ba7546f8573d536582172643a90c7e55
MD5 59493ac0436831b2f6c2da56cec6775e
BLAKE2b-256 b6709377fc0a681a03eea82782766b90a85e46dd8ed989828e66de0722011e26

See more details on using hashes here.

File details

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

File metadata

  • Download URL: secrets_hunter-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for secrets_hunter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6ca2ab9561d92ed73f7d35959ca4bfff1c841dbc3990c33cc2efde9c9f3fc92
MD5 c18717250b483f14802d1fc8406cf93a
BLAKE2b-256 43a001d393ef390e6fc48705c16018caf489d36b9c894172a9c0dd7d597551ab

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