NEWSDante is a free watchman for your own machines. See what is new in the library.Library →
Dante

How to find leaked API keys and secrets on your own machine

Most leaked keys are not stolen by genius. They sit in a file that many programs can read. Here is where to look, how to judge what you find, and what to do next.

A typical project. Four of these five spots are the ones attackers try first.

Where secrets hide

How to judge a finding

A key in a private, git-ignored .env in your own project is normal. The same key becomes a finding when one of these is true:

  1. The file is world-readable (other accounts or services can open it).
  2. The file is tracked or was ever committed to Git.
  3. It sits in a folder a web server publishes.
  4. It is a long-lived token with write power (publishing packages, cloud admin).

How Dante does it

The deep run (deep, or weekly if you agree to a schedule) searches your project folders for secrets using patterns for 1,111 formats - AWS, GitHub, Stripe, private keys, database URLs and many more. It first looks which systems are in the project (package.json, composer.json, requirements.txt) and only uses the fitting patterns, so it stays fast and quiet. On a hit it looks closer: file rights, is it in Git, was it ever committed, is it ignored.

It shows the file, the line and the kind of secret - never the value. Example files (*.example) and placeholder lines are skipped, as are node_modules, .git, vendor and build folders. Nothing leaves your machine.

user ❯ deep
  OPEN  GitHub token  app/deploy.sh  line 8
        in Git history (committed 2026-03-02) · file mode 644
  SAFE  AWS key  .env  (private, git-ignored: normal for a local .env)
Illustration of the format, shortened. Real results show the command output they come from.

What to do when you find one

  1. Rotate first. Assume the key is known. Create a new one at the provider and revoke the old one. Removing the line is not enough.
  2. Move the new secret to a place that is not committed: a private git-ignored .env, your OS keychain, or a secrets manager.
  3. If it was committed, rotating matters more than rewriting history; rewrite only to stop further spreading.
  4. Tighten file rights: private files should be readable by you only (mode 600 on Mac and Linux).
Check your own machine nowInstall Node.js, open a terminal, type npx dante-watch. Step-by-step for Mac, Windows and Linux.
Nothing to lose by looking.Dante only reads. It asks before every change and shows the command first. No account. Delete the folder ~/.dante and it is gone.

Questions people ask

How do I find API keys in my code?

Search the project for known key formats and check each hit for file rights, Git tracking and history. A tool with a library of formats does this faster and with fewer false alarms than a plain text search.

Is a key in my local .env a leak?

Not if the file is private, git-ignored and never committed. It becomes a problem if it is world-readable, tracked by Git, or in a folder a web server publishes.

Does Dante show my secrets?

No. It shows the file, the line and the kind of secret, never the value.

More

Check your machine: npx dante-watch · how