Guides / Key-scanning tools

Tools that find API keys in AI-written code

AI coding sessions commit fast, and keys go with them. Five scanners compared on price and strengths, a setup that costs nothing, and the security numbers to track every month.

Catch keys at four points, not one

Where a leaked key can be stopped

  1. 1On the laptopA pre-commit hook blocks the commit that contains a key.
  2. 2On pushGitHub push protection blocks known key formats.
  3. 3In the historyA full scan finds keys committed months ago.
  4. 4In productionAlerts, rotation and audit logs limit the damage.
AI coding sessions commit quickly. The pre-commit hook is the cheapest layer and catches the most.

The tools, compared

API key scanning tools compared
ToolLicence or priceBest atNote
GitleaksMIT, freePre-commit hooks and scanning full git historyFast, simple, no account needed
TruffleHogAGPL-3.0, freeVerifying whether a found key is still liveScans git, GitHub, S3, Docker images; 800+ secret types
GitGuardian (ggshield)Free for up to 25 developersMonitoring every repository with alerts and a dashboardPublic monitoring is a paid feature
GitHub secret scanningFree on public repositoriesBlocking known key formats on pushPrivate repositories need Secret Protection: $19 per active committer per month
Semgrep SecretsTeams plan, $15 per contributor per monthFollowing a secret through the codeValidates keys locally; not in the free edition

A setup that costs nothing

For a small team, this combination covers the first three points for free:

# .pre-commit-config.yaml: block commits that contain keys
repos:
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.1
    hooks:
      - id: gitleaks
pip install pre-commit && pre-commit install   # once per laptop
gitleaks git -v                                 # scan the full history now
trufflehog git file://. --results=verified      # which found keys still work
  • Turn on push protection for your account and for public repositories.
  • Run the history scan once now, then in CI on every pull request.
  • Treat a verified result as an incident: rotate first, then clean the history. See the first hour after a leak.

Keeping track of security over time

Security metrics to track monthly
What to trackWhereTarget
Open secret alertsGitHub Security tab, GitGuardian dashboardNone older than a week
Keys older than their rotation dateInfisical, AWS Secrets Manager, Azure Key VaultNone
Who read which secretVault audit logsReviewed monthly
Dependencies with known vulnerabilitiesGitHub Dependabot alertsCritical ones fixed within a week
AI spend against limitsClaude Console, OpenAI, AWS BudgetsNo surprises

Sources

Checked on 2 December 2026. Prices and product names change; the linked pages are the reference.

How I help

I scan the full history of every repository, rotate what is live, and set up the hooks and alerts so it does not happen again.

  • History scan and cleanup: every repository, verified results, rotation and history rewrite.
  • Guardrails: pre-commit hooks, CI scanning, push protection, Claude Code deny rules.
  • Operate: monthly security numbers as part of running your systems.

Done by a Claude Certified Architect and Certified Lovable Expert. Everything stays in your accounts.

Questions

Which secret scanner should a small team start with?

Gitleaks as a pre-commit hook and in CI. It is free, fast and needs no account. Add TruffleHog to check whether found keys are still live.

Does GitHub scan private repositories for free?

No. Push protection and secret scanning are free on public repositories. Private repositories owned by an organization need GitHub Secret Protection, $19 per active committer per month.

What is the difference between Gitleaks and TruffleHog?

Gitleaks finds key-shaped strings quickly. TruffleHog also tests whether each key still works, which tells you what to rotate first.

Is GitGuardian free?

Its Starter tier is free for up to 25 developers and covers monitoring of internal repositories. Monitoring public exposure is a paid feature.

Start with a conversation

Thirty minutes, no charge. Tell me what you have built and where it stopped. If I am not the right person, I will say so and point you somewhere better.

Calendar not loading? Open the booking page or email me.