{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "yelp-detect-secrets--block-new-secrets-with-detect-secrets-pre-commit",
 "repo": "Yelp/detect-secrets",
 "repo_url": "https://github.com/Yelp/detect-secrets",
 "repo_slug": "yelp-detect-secrets",
 "title": "Block new secrets at commit time",
 "page_title": "How to block new secrets at commit time with Detect Secrets",
 "summary": "Add the pre-commit hook so only staged files are scanned against the baseline before each commit.",
 "who": "A team lead who wants leaks caught before they reach the remote.",
 "problem": "Secrets pushed to a shared repo must be rotated, which is costly.",
 "outcome": "Commits that fail when a new secret appears, while known baseline entries pass.",
 "steps": [
  "Add the Yelp/detect-secrets repo with `id: detect-secrets` and args --baseline .secrets.baseline to .pre-commit-config.yaml, as in the README",
  "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`",
  "Mark known false positives inline with a pragma: allowlist secret comment"
 ],
 "agent_prompt": "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.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Beginner",
 "time": "20 minutes",
 "basis": "readme",
 "caveat": "The README says it will not catch multi-line secrets or default passwords that do not trigger the KeywordDetector.",
 "category": "Security and science",
 "tags": [
  "Security and science"
 ],
 "lang": "",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/yelp-detect-secrets/block-new-secrets-with-detect-secrets-pre-commit/",
 "md": "https://dedupedai.com/use-cases/yelp-detect-secrets/block-new-secrets-with-detect-secrets-pre-commit/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/yelp-detect-secrets--block-new-secrets-with-detect-secrets-pre-commit.json",
 "api_version": "v1"
}
