Secret scanning is automated detection of credentials, such as API keys and tokens, accidentally committed to code, config or other text.
Secret scanning tools search repositories, commit history, pull requests and sometimes chat and ticket systems for strings that look like credentials. They use pattern matching on known formats, such as provider-specific prefixes, plus entropy checks and sometimes validity checks that confirm the key still works. GitHub secret scanning runs on repositories and, through its partner programme, notifies providers whose tokens it finds so they can revoke them. Push protection blocks a commit before the secret reaches the repository. Open-source tools such as gitleaks and TruffleHog run in CI or as pre-commit hooks. Scanning is a safety net, not a strategy: it only finds secrets after they have been written somewhere, and history rewrites do not undo exposure, because copies, forks and caches may already exist. When a scanner finds a live credential, treat it as compromised: revoke or rotate it first, then clean up the repository and review audit logs for misuse. To reduce findings, keep secrets out of working directories in the first place and use placeholder names in examples. AI-agent workflows add a new surface, since transcripts and generated files can contain secrets. BotPassword cuts leaks upstream by keeping values out of files and prompts.