detect-secrets (Bridgecrew Fork)

1.5.47 · active · verified Thu Apr 09

detect-secrets (Bridgecrew fork) is a Python tool designed for detecting secrets within a codebase. It focuses on enterprise use cases by providing a systematic way to prevent new secrets, detect explicit bypasses, and offer a checklist for secret migration. Unlike tools that solely find secrets, it emphasizes baseline management to allow for gradual remediation of existing secrets while blocking new ones. The current version is 1.5.47, and it is actively maintained on GitHub.

Warnings

Install

Imports

Quickstart

The primary quickstart involves using the command-line interface to create a baseline file. This file (`.secrets.baseline`) tracks existing 'secrets' in your repository, allowing the tool to focus on preventing *new* leaks. The baseline can then be used with pre-commit hooks or CI/CD pipelines.

# 1. Navigate to your repository root.
# 2. Run the scan command to create an initial baseline file.
#    This file records all currently detected 'secrets' to be ignored in future scans.
detect-secrets scan > .secrets.baseline

# 3. (Optional) Add to .pre-commit-config.yaml for Git hook integration:
#    - repo: https://github.com/bridgecrewio/detect-secrets
#      rev: 1.5.47 # Use the current version
#      hooks:
#        - id: detect-secrets
#          args: ['--baseline', '.secrets.baseline']

# 4. To update the baseline with new secrets or remove old ones:
detect-secrets scan --update .secrets.baseline

view raw JSON →