Skip to content
BENIBIX Learn

Secret Scanning

Development🔐 SecuritySecurity Testing

Also known as Secret Detection, Push Protection, Leaked Secret Scanning

A check for keys and passwords left in code. It runs before others see it.

Think of it like

Think of it like a guard who looks in your bag for keys.

Example

Lucy pushes a commit with a cloud key pasted into a test file. GitHub blocks the push and shows her the exact line.

Why it matters

Bots search public code for leaked keys all the time. One key can run up a big bill or open your data.

Definition

Secret scanning looks through code for passwords, API keys and tokens that should not be there. It runs on each change, often before the code is pushed. If it finds one, it warns you or blocks the push. Many code hosts and tools offer it. Once a secret has reached a shared repository, you must replace it, because deleting the line does not erase the history.
Secret scanning sits at the push step, before code with a key in it is shared.

Common mistake

Deleting the secret in a new commit and moving on. It is still in the history, so the key must be replaced.

Key takeaways

  1. 1
    Scan every change. Catch keys before they are shared.
  2. 2
    Block or warn. Stop the push or flag it.
  3. 3
    Replace leaked keys. The history keeps the old one.