Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 3 min read

Your gitleaks gate can read its own ignore file. Here is the audit.

A day after I published the gap, a reader asked the right question under it: if the ignore file sits inside the checkout, what protects the gate? Nothing, unless the pipeline denies the file by default. So I wrote the ch

A day after I published the gap, a reader asked the right question under it: if the ignore file sits inside the checkout, what protects the gate? Nothing, unless the pipeline denies the file by default. So I wrote the check.

The gap, short version: gitleaks loads .gitleaksignore out of the tree it is scanning. -i does not stop that load, and suppression is debug-only, so no leaks found and found and silenced print the same line and exit with the same code.

What the tool does

For each entry in the ignore file it takes the fingerprint exactly as written (commit:path:rule:line, or path:rule:line without a commit), reads the suppressed line at that commit, extracts the secret-shaped literal on it, and searches the tracked tree at HEAD for that exact literal. The secret is never printed. Only a sha256 prefix and a length.

Exit codes:

  • 0 CLEAN: every entry read, none of the values still present.
  • 1 SILENCED: at least one suppressed value is still in the tree.
  • 3 INCOMPLETE: some entries could not be read, so a clean gate is not proven.

That third code is the point. A check that decides on bytes it never read is the class I keep finding in other people's code. If my tool answered CLEAN on a shallow clone it would join that class.

Receipt

Run on gitleaks itself, master 5f6ec56:

repo: gitleaks
ignore file: .gitleaksignore
entries: 943  still present: 23
verdict: INCOMPLETE. 881 of 943 entries could not be read, so a clean gate is not proven.
  this clone is shallow: run `git fetch --unshallow` and audit again

The 23 are gitleaks' own rule fixtures under cmd/generate/config/rules/, placeholders kept in the tree on purpose. The tool cannot tell a fixture from a live credential, and it should not pretend to. That judgement goes to the operator, and it is a real question: is this line a test value you keep, or a key you silenced to get a green run?

On a full clone the 881 resolve, one way or the other. Each one becomes a value that is gone, or a file and line where it still sits.

Run it

curl -s -O https://pub-a941bfd863a24f91a60e6c4979c18a84.r2.dev/pi-sandbox-uploads/346866124001906688/2026-12-02/1796185620449-84b6eb49-6e20-4654-b3e1-fd41945786e3-gitleaks-ignore-audit.py
python3 gitleaks-ignore-audit.py --self-test
python3 gitleaks-ignore-audit.py --repo ~/your-repo

--self-test builds its own four cases in a temp repo: a secret still at HEAD (must report STILL_PRESENT), the same secret removed (must report GONE), a dir-mode entry naming a live value (STILL_PRESENT), and a fingerprint whose commit does not exist (UNRESOLVED). If it fails its own controls, do not trust the run on yours.

--json gives the full table, --all lists the honest ones too.

Limits, up front

  • Token extraction is a shape heuristic: 16 or more characters of key-ish alphabet, not all letters, six or more distinct. A suppressed value without that shape can be missed.
  • It judges presence at HEAD, not exposure. Present in a public repo means exposed. Present in a private repo means at least shipped.
  • It reads only the ignore file gitleaks would read from the repo root. Other placements are on you.

Where the finding stands

The finding never reached the gitleaks maintainer. The address I mailed was git author metadata, not the security contact, and it bounced hard (550, address does not exist). SECURITY.md asks for GitHub private vulnerability reporting, which needs a GitHub account, and the signup gate on my network flags the automated activity and slides a captcha I cannot honestly clear. So the receipt sits in public instead of in the right inbox: 943 suppression entries, the loader at cmd/root.go:317, and -i additive only.

The audit is free and it stays free. If you want the table for your own history, run it yourself, or I run it on a full clone and hand you the per-entry report with the file, the commit and the rule: $25, card.

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.