Lockhound

Leaked secret detection

Catch API keys and secrets committed to your code

Lockhound finds API keys, tokens, private keys and database passwords in your GitHub repositories, alerts on new ones and fails pull requests that add one.

A key pasted into a config file to "just get it working" is one of the most common ways a company is breached. Once it is committed, everyone who can read the repository can use it, and so can anyone who later gets a copy of the code. Lockhound's secret check finds those keys and tells you where they are.

What it finds

  • Provider keys and tokens, recognised by their published formats: AWS, GitHub, GitLab, Stripe, Slack, OpenAI, Anthropic, SendGrid, npm, PyPI, DigitalOcean, Shopify, Hugging Face, Telegram and Google.
  • Private keys: RSA, EC, OpenSSH and PGP, including the one inside a Google service account file.
  • Database URLs with a password for PostgreSQL, MySQL, MongoDB, Redis and RabbitMQ.
  • Real values in a committed .env file.

Those are reported as critical or high. A random-looking value assigned to something named like apiKey or secret is only a guess, so it is listed as medium: you see it, but it never sends an alert or blocks a pull request. Placeholders such as your-api-key, local defaults and anything in test, fixture, example or docs folders are treated the same way.

What happens when it finds one

  • The repository page shows the file, the line, the kind of credential and a masked preview such as sk_liv…a2, with a link to the line on GitHub.
  • New critical and high secrets go to your Slack and email channels once.
  • With pull request checks on, a pull request that adds a secret fails, naming the file and line. Secrets already on the default branch are not blamed on the pull request.
  • When the secret is gone from the default branch, the next scan marks it resolved. A false positive, such as a Google API key that is public by design, can be marked safe.

What to do with a leaked key

  1. Revoke or rotate it with the provider first. This is the step that makes you safe.
  2. Then remove it from the code and load it from the environment or a secret manager.
  3. Deleting the line is not enough on its own: the value stays in the git history.

It is off until you turn it on

Everything else Lockhound does reads only dependency files and a few files malware hides in. Finding secrets means reading source and configuration files, so this check is opt-in: an admin turns it on under Settings → Workspace. It is part of the Team and Business plans.

  • Files are read through GitHub's API, checked in memory and discarded. Your repository is never cloned.
  • The secret's value is never stored, logged, put in an alert or shown on a pull request.
  • Lockhound never tests a key against its provider.
  • Images, fonts, archives, lockfiles and installed code (node_modules, vendor) are never read.
  • A file version that was read and found clean is not read again.

The full list of what is read and kept is on the security and permissions page.

What it does not do

It checks the files of the current commit and of each pull request, not your whole git history. A key that was committed and later removed, but never rotated, will not be found. It also does not rotate keys for you or check whether a key is still active.

Read next