detect-secrets
detect-secrets is an open-source Python tool for finding potential secrets in a codebase and helping prevent new ones from being committed.
What detect-secrets is
detect-secrets is an open-source Python tool for finding potential secrets in a codebase and helping prevent new ones from being committed. It checks code changes with heuristic detection that includes regular expressions, entropy analysis, and keyword matching. A scan creates or updates a baseline of potential secrets already in a repository; hook and audit commands support flagging new findings and reviewing baseline entries. In an audit, analysts can label findings as true or false positives and report or compare results. The project recommends running detect-secrets as a pre-commit hook through the pre-commit framework, and the package can also be imported into Python scripts to scan files and serialize findings. Users can tune built-in plugins and filters, build custom detectors, and suppress false positives through exclusions or inline allowlist comments. Installation is documented for pip and Homebrew. It supports Git on Linux, macOS, and Windows, with self-hosted use, and its repository lists the Apache-2.0 license. Some options need extra packages, and the heuristic hook does not catch every secret.
Good
- Creates or updates a repository baseline.
- Provides scan, hook, and audit commands.
- Supports custom detector plugins and filters.
- Can suppress findings with exclusions or inline comments.
- Free, open-source software with pip and Homebrew installation.
Watch out
- The heuristic hook misses multiline secrets and some default passwords.
- Word-list filtering and gibberish detection need optional packages.
- Gibberish detection is not enabled by default.
Who it suits
It suits teams looking for Git pre-commit secret scanning, particularly enterprise clients. Python users can also import it into scripts to scan files and serialize findings.
Verdict
detect-secrets combines baseline review with pre-commit checks and configurable detection. Its heuristic approach has stated gaps, so it should not be treated as catching every secret.
Plans and prices
From detect-secrets's own pricing page, checked 9 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| detect-secrets | Free | Open-source Python module; install with pip or Homebrew |
The facts
Each one read from detect-secrets's own pages, with the date it was checked.
What it does
- Audit
- The audit command lets analysts label baseline findings as true or false positives and report or compare results.checked 9 Oct 2026
- Baseline
- A scan creates a baseline of potential secrets already present in a repository.checked 4 Oct 2026
- Baselines
- The scan command creates or updates a baseline of potential secrets found in a repository.checked 9 Oct 2026
- Custom detectors
- Users can develop custom detector plugins and use them with the engine.checked 9 Oct 2026
- Customization
- Users can develop custom detector plugins and filters, and adjust built-in plugins and filters.checked 4 Oct 2026
- Detection
- Its detection strategies include regex rules, entropy heuristics, and keyword detection.checked 9 Oct 2026
- Detection methods
- Its detection strategies include regex rules, entropy detection, and keyword detection.checked 4 Oct 2026
- False positive handling
- Users can exclude matching lines, files, or secret values and can use inline allowlist comments.checked 4 Oct 2026
- False positives
- Users can tune scanning with built-in or custom filters, exclusions, and inline allowlist comments.checked 9 Oct 2026
- Installation
- The project documents installation with pip or Homebrew.checked 4 Oct 2026
- Integrations
- The README documents installation through pip and Homebrew and integration as a pre-commit hook.checked 9 Oct 2026
- Intended users
- The project describes itself as designed with the enterprise client in mind.checked 4 Oct 2026
- License
- The repository identifies its license as Apache-2.0.checked 9 Oct 2026
- Limitations
- The project says its heuristic hook does not prevent every secret and lists multiline secrets and some default passwords as cases it will not prevent.checked 9 Oct 2026
- Optional extensions
- Word-list filtering and the gibberish detector require optional packages; the gibberish detector is not enabled by default.checked 4 Oct 2026
- Optional extras
- Word-list filtering and a gibberish detector are optional features that require additional packages.checked 9 Oct 2026
- Purpose
- detect-secrets detects secrets in code and helps prevent new secrets from entering a codebase.checked 9 Oct 2026
- Python use
- The package can also be imported into Python scripts to scan files and serialize findings.checked 9 Oct 2026
- Scanning tools
- The project provides scan, hook, and audit commands to create baselines, flag new secrets, and review baseline findings.checked 4 Oct 2026
- Workflow
- The project recommends using detect-secrets as a pre-commit hook through the pre-commit framework.checked 9 Oct 2026
Where it runs
- Detection approach
- It checks code changes using heuristically crafted regular expressions to identify newly committed secrets.checked 4 Oct 2026
The full review of detect-secrets
detect-secrets is a free, open-source Python module for finding likely secrets in Git codebases and checking changes before they are committed. It fits developers and teams that want a self-hosted, configurable safeguard in an existing development workflow. The strongest case is its baseline-and-review process; the main caveat is that heuristic scanning has known blind spots.
Overview
A repository scan creates or updates a baseline of potential secrets already present. Subsequent checks can focus on newly added matches instead of repeatedly stopping work over inherited findings. The audit command gives analysts a way to review baseline entries, mark true or false positives, and report or compare results.
Detection combines regular-expression rules, entropy heuristics, and keyword checks. That mix can catch different styles of credentials, but it remains probabilistic. The project explicitly cautions that its pre-commit hook does not prevent every secret, including multiline secrets and some default passwords. It is therefore a useful development barrier, not a complete guarantee against credential exposure.
Key features
Baseline, hook, and audit commands
The scan command establishes the repository baseline, the hook flags new potential secrets, and audit supports structured review of existing findings. This division suits teams introducing scanning to a mature codebase, because old matches can be tracked without being confused with fresh changes.
Configurable detection
Built-in detectors and filters can be adjusted, while custom detector plugins and filters let teams match their own credential formats. Regex, entropy, and keyword strategies provide a practical starting point, but tuning requires ownership from someone who understands the code and the organization’s secret patterns.
False-positive controls
Users can exclude matching lines, files, or secret values and add inline allowlist comments. These controls keep recurring benign matches from overwhelming reviews, although every exclusion creates a responsibility to ensure a real credential is not being hidden.
Developer and Python workflows
The project recommends installing the pre-commit hook through the pre-commit framework. It can also be imported into Python scripts to scan files and serialize findings, making it suitable for teams that want to embed checks in their own tooling. Word-list filtering and the gibberish detector are optional extensions requiring additional packages; gibberish detection is off by default.
Pricing
| Plan | Price | Includes |
|---|---|---|
| detect-secrets | free | Open-source Python module; install with pip or Homebrew |
There is no paid tier or free-trial period. The Apache-2.0 license and self-hosted installation make it a natural fit for teams that can operate their own scanning workflow and do not need a hosted service, account management, or vendor support terms.
Platforms
detect-secrets supports Linux, macOS, Windows, and self-hosted deployments. It targets Git repositories and can run through pre-commit, while Python import support accommodates custom scripts and internal automation.
Who it's for
The project is designed with enterprise clients in mind, but its zero price and local workflow also suit small engineering teams that want repository-level checks without sending code to a hosted platform. It is a good choice when developers can maintain baselines, review findings, and tune detectors. Teams needing broad secret coverage without active configuration, or a service that manages monitoring centrally, should consider a different category of tool.
Pros and cons
Pros
- Free and open source: Apache-2.0 licensing and pip or Homebrew installation avoid subscription costs and support self-hosted operation.
- Practical onboarding for existing repositories: Baselines separate historical findings from newly introduced ones.
- Flexible rules: Built-in filters can be adjusted, and custom detectors and filters can cover organization-specific formats.
- Reviewable workflow: Audit labels true and false positives, while exclusions and inline allowlists handle recurring benign matches.
- Fits Git development: The recommended pre-commit integration checks changes before they enter version control.
Cons
- Heuristic gaps: Multiline secrets and some default passwords may evade the pre-commit hook.
- Maintenance burden: Baselines, allowlists, and custom detectors need ongoing human review.
- Optional detection extras: Word-list filtering and gibberish detection require additional packages, and gibberish detection is not enabled by default.
- Git-focused scope: Its documented workflow centers on Git repositories and developer checks rather than a hosted, organization-wide service.
Alternatives
Vooda AI is worth choosing when a freemium service with API, web, and self-hosted access is preferable; its Self-hosted plan is free for production use at any company size with no seat limits and requires Docker.
GitGuardian suits teams wanting a hosted freemium option with a free trial, real-time scanning for up to 25 developers, and historical scan limits on its Starter plan.
Semgrep Code is the alternative for teams seeking broader code and supply-chain analysis, with a free edition capped at 10 repositories and 10 contributors.
Amazon Deequ is an Apache 2.0 open-source library that requires Apache Spark and matching release versions.
DeepSource offers a freemium, hosted-oriented workflow with an Open Source plan for unlimited public repositories and team members.
Endor Labs fits developers wanting free local scans through its AURI MCP server without an account.
Augustus is another Apache 2.0 open-source option, with API usage potentially requiring provider credentials.
ByteHide Secrets is a freemium choice whose free plan allows up to 2,000 secrets without a credit card.
For a wider category comparison, see Secrets Scanning Software.
Verdict
Choose detect-secrets if you want a no-cost, self-hosted Git check with baselines, audit review, and rules you can extend in Python. Look elsewhere if missed multiline or default-password secrets, manual tuning, or the absence of a hosted management layer would be unacceptable.
Alternatives to detect-secrets
- 1

DeepSource
Free planWebAPILinuxmacOS8.0From $30 a month - 2

Endor Labs
Free planWebAPIExtensionLinux7.4Free plan - 3

Vooda AI
Free planWebAPILinuxmacOS6.9Free plan - 4

Arnica Secrets Security
Free planWebAPISelf-hosted6.6From $300 a year - 5

GitGuardian
Free planWebAPILinuxmacOS6.6Free plan - 6
ByteHide Secrets
Free planWebAPILinuxmacOS6.3Free plan
