DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to block new secrets at commit time with Detect Secrets

Add the pre-commit hook so only staged files are scanned against the baseline before each commit.

Short answer: Add the Yelp/detect-secrets repo with id: detect-secrets and args --baseline .secrets.baseline to .pre-commit-config.yaml, as in the README; then Scan staged files by hand with git diff --staged --name-only -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline; Scan all tracked files with git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline. All steps.

Who it is forA team lead who wants leaks caught before they reach the remote.

The problemSecrets pushed to a shared repo must be rotated, which is costly.

The outcomeCommits that fail when a new secret appears, while known baseline entries pass.

What you need first

  • Python with pip (`pip install detect-secrets`) or Homebrew (`brew install detect-secrets`)
  • A git repository to scan
  • Optional: the pre-commit framework for the hook

Steps

  1. Add the Yelp/detect-secrets repo with id: detect-secrets and args --baseline .secrets.baseline to .pre-commit-config.yaml, as in the README
  2. Scan staged files by hand with git diff --staged --name-only -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
  3. Scan all tracked files with git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
  4. Mark known false positives inline with a pragma: allowlist secret comment

Prompt for your agent

Set up Yelp/detect-secrets as a pre-commit hook in <my repo> using the README config, then run `git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline` and report any new findings.

Caveat. The README says it will not catch multi-line secrets or default passwords that do not trigger the KeywordDetector.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for Yelp/detect-secrets and "Block new secrets at commit time"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer