bc-detect-secrets
Tool for detecting secrets in the codebase
What it is and what it does
bc-detect-secrets is a secret-detection tool designed for enterprise use, scanning codebases to find hardcoded credentials, API keys, and tokens. Unlike simple pattern matchers, it uses a baseline approach: you create a snapshot of secrets currently in your repository, then the tool prevents new secrets from being committed without explicitly bypassing the check. It runs on git diffs rather than full repository scans, reducing overhead.
The package includes multiple detection plugins and integrates with git hooks and pre-commit workflows. It's maintained by Bridgecrew as a fork of the original Yelp detect-secrets project and depends on pyyaml, requests, and unidiff for configuration, HTTP operations, and diff parsing.
Use it for:
- Prevent accidental commits of API keys and database credentials in development workflows via pre-commit hooks
- Create and maintain a baseline of known secrets in legacy codebases while blocking new ones from entering
- Audit existing repositories to identify and catalog secrets for rotation and migration to secure vaults
- Integrate secret detection into CI/CD pipelines to catch credentials before they reach shared branches
- Customize detection rules for organization-specific secret patterns and reduce false positives through filtering
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Detects secrets (API keys, tokens, credentials) in code repositories by scanning diffs and files against heuristic patterns, with support for baseline management to prevent new secrets from entering the codebase.
Yes. Active maintenance, no known vulnerabilities, low install friction, and permissive licensing make it a practical choice for teams needing to prevent secret leaks. The baseline-first approach is well-suited to large legacy codebases where immediate remediation is infeasible. Install if you need systematic secret detection in git workflows; skip if your codebase is already fully credential-free and you only need occasional ad-hoc scanning.
Install
bc-detect-secrets on PyPI
pip
pip install bc-detect-secretsuv
uv add bc-detect-secretspoetry
poetry add bc-detect-secretsInstalling bc-detect-secrets
Before you install
Low install friction with three lightweight runtime dependencies (pyyaml, requests, unidiff). Active maintenance as of 2026-08-13 with recent release. Supports Python 3.8 through 3.13.
License in practice
Apache License 2.0 (permissive) allows use in commercial and private projects with minimal restrictions; you must include a copy of the license and note material changes.
Quickstart
pip install bc-detect-secrets
# Create baseline of current secrets
detect-secrets scan > .secrets.baseline
# Use in git hook to block new secrets
git diff --staged --name-only -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
Requires git repository context for diff-based scanning; full-file scanning available with --all-files flag but intended for initial baseline creation.
Verify before relying
- Accuracy of the heuristic regex patterns and entropy checks against real-world secret types
- Performance impact when scanning large repositories or high-frequency pre-commit usage
- Customization depth available for organization-specific secret patterns beyond built-in plugins
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — pyyaml, requests, unidiff |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,525,004/month — #2,080 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bc_detect_secrets-1.5.49-py3-none-any.whl
Keywords: secret-management, pre-commit, security, entropy-checks
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
cycodeCycode is a command-line security scanner that…
permissive · top 15,000 on PyPI
detect-secretsDetects secrets (API keys, tokens, credentials)…
permissive · top 5,000 on PyPI
trufflehog3Scans Git repositories and source code for…
unclear · top 15,000 on PyPI
kingfisher-binKingfisher is a command-line secret scanner…
permissive · top 15,000 on PyPI
truffleHogScans Git repositories and other sources for…
unclear · top 15,000 on PyPI
dodgyDodgy scans Python source code for suspicious…
permissive · top 15,000 on PyPI
ggshieldggshield is a CLI tool that scans files,…
permissive · top 15,000 on PyPI
pygitguardianAPI client library for GitGuardian's secret…
permissive · top 15,000 on PyPI
microsoft-security-utilities-secret-maskerDetects and masks sensitive data in text using…
permissive · top 5,000 on PyPI
flawfinderFlawfinder scans C/C++ source code to identify…
copyleft · top 15,000 on PyPI