Lion Cipher Lab

Find hardcoded secrets in your code and git history with Gitleaks

Why it matters

A secret is any credential your code uses to prove who it is: an API key, an access token, a database password, a private key. When one of these gets committed into source code, it does not just sit quietly in your project. Secrets leak into git history, get pushed to shared or public repositories, land in backups, and get copied into logs. Attackers know this, so automated bots constantly scrape public code hosts for exposed keys and can start abusing a leaked credential within minutes of it appearing. Leaked secrets are consistently one of the most common ways real breaches begin, because a…

What you'll learn

Steps in this lab

  1. Why a leaked secret is such a big deal
  2. What Gitleaks is, and installing it
  3. Plant a fake secret in your OWN repo and scan the working tree
  4. Commit it, then scan the full git history
  5. Read the finding
  6. The most important step: rotate the secret, do not just delete the commit
  7. Stop the next leak: a pre-commit hook and a custom rule
  8. Tune out false positives: .gitleaksignore and allowlists
  9. Where this habit pays off

Open the full interactive lab →