detect-secrets

detect-secrets is a Python package from Yelp for detecting secrets within a code base.

Install

pip install detect-secrets

Create an initial blank baseline.

detect-secrets scan > .secrets.baseline

Run

Detect unknown secrets against the baseline.

detect-secrets scan --baseline .secrets.baseline

Audit

Allow certain secrets to be committed to the code base. For example, a variable named secret in a test file.

detect-secrets audit .secrets.baseline

A wizard will pop up and ask you if you want to allow each detected secret into code base. It will update the .secrets.baseline file depending on your answer.

For example, if you say "yes" and allow a secret, it will flag that secret with "is_secret": false in the baseline.

detect-secrets
Interactive graph
On this page
Install
Run
Audit