Skip to main content
A key gets committed, someone notices, the line is deleted and the fix is pushed. Your current files are clean, but the key is still inside the commit that first added it. Anyone who clones the repository can find it there. The history secrets scan finds those keys. It requires Pro. It uses the same two checks for secrets as a normal scan, applied to your past commits instead of your current files.

How it works

Each commit adds or changes some files. The scan reads every file version a commit added or changed, including committed .env files. A file that a commit left unchanged is not read again, so a long history still scans quickly.
  • One finding per secret. The same key across ten commits is reported once, with when it first and last appeared, how many commits contain it and which files.
  • Always masked. You see sk_live_****. The real value never leaves the analysis engine, so it never reaches a panel, a log or a JSON export.
  • Still there, or gone? Each finding says whether the secret is still in HEAD, meaning your latest commit still contains it, or only in older history. A finding still in HEAD links straight to the line.
  • Merge commits count. Content added by a merge itself, such as a conflict resolution, is scanned too.
  • Entirely local. The scan runs your own copy of git. No code, history or findings leave your machine.

Running it

In your editor: open the Workspace tab, go to Security Posture and click Scan git history for secrets. You can also run Iris Code: Scan Git History for Secrets from the command palette. Results open in their own panel, with a search box and filters for secrets still in HEAD versus history only. In a terminal:
The command exits with 1 if it finds anything in the commits it scanned, so an automated check can fail on it.

It always tells you what it didn’t check

The scan has limits, so a long history may not be read in full. A result that looks complete when it is not would be trusted wrongly, so every limit that applied is reported with the findings: A “blob” is Git’s name for one stored version of a file. A shallow clone is a copy of the repository that was downloaded without its older history. Because of these messages, “no secrets found” never quietly stands in for “no secrets found in the part that was scanned”.

Acting on a finding

Replace the credential with a new one. This applies even to findings that are only in history, where the secret was removed from your files long ago. Anyone who has ever cloned the repository holds that commit on their own machine, as does any fork, CI system or backup that touched it. There is no way to find out who read it, so the old value has to be treated as compromised. Removing it from history as well means rewriting the history with git filter-repo, after which everyone has to clone the repository again. That is worth doing for a public repository, but it does not replace getting a new credential: by the time the history is rewritten, the old value has already been exposed.