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
- Clone this repository
git clone https://github.com/FVLCN/secrets-hunter.git secrets-hunter
cd secrets-hunter
- Activate virtual environment (macOS and Linux)
python -m venv venv
source venv/bin/activate
- 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
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 secrets_hunter-0.2.0.tar.gz.
File metadata
- Download URL: secrets_hunter-0.2.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c201726979ea0e8cb8de3dc0dae1c764192243db3fab0f12506c8938133edce
|
|
| MD5 |
358e048dd6be6efb72fefea0ec376c2a
|
|
| BLAKE2b-256 |
a250a24f1a815c39bc95ab528bc3dc7b2a529bd0c93f0eac21f14b9011555852
|
File details
Details for the file secrets_hunter-0.2.0-py3-none-any.whl.
File metadata
- Download URL: secrets_hunter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6670bfb990651284c767448c6f6de471b4dabcaff35c175087cc11a754460363
|
|
| MD5 |
df593e074806d063d5467bbe533bdc75
|
|
| BLAKE2b-256 |
55d253b0eba5daa0848521383928b7fd65a73a03412137ad73d6ac6cc08326cc
|