HackBlue

Tools · Secrets and dependency scanning · 15 / 26

gitleaks: a directory scan has no commit

A scan of a folder that is not walked as git history has no commit on the finding. Write that. Do not invent a commit, and do not describe the match as something history still contains.

11 min read · practice only with authorization

The mode is part of the result

gitleaks can walk commits, or it can read the files in a directory without treating them as history. A finding from the directory mode names a file and a rule. It does not name a commit, because that scan did not visit commits. The absence of a commit is the mode, not a broken report.

A history scan’s finding has a commit and a date. Those fields are not optional decoration. If they are missing, you are not looking at a history result, or the paste dropped them. Say which, once you know.

The file is the working tree or the export

The path on a directory-mode finding is a file that was on disk for that scan. It is not a path “still in git history.” Deleting the file after the scan does not create a historical commit you did not record. The finding remains a match in that folder at scan time.

Do not copy a commit hash from a different scan of the same repository onto this finding so the ticket looks complete.

What to file

File the rule id, the file, the line, the scan time, and the mode: history or directory. If the mode was directory, write “no commit on this finding.” If you are unsure because the paste is partial, write “mode not recorded” and do not add a hash.

Worked case: a folder export filed as history

A lab export of a docs folder is scanned as files on disk. The finding is rule generic-api-key, file notes.txt, line 4, no commit field. A draft adds commit 9c1e2b7 from an older history scan of a different path and says the secret remains in history.

The note says directory mode, no commit, file notes.txt at scan time. The older hash stays on its own finding. This match is not described as history. If someone later scans the git history, that is a new result with its own commit field.

Snippet
mode: directory
rule: generic-api-key
file: notes.txt  line: 4
commit: none on this finding
scan time: 2026-11-03T09:00:00Z
not: commit 9c1e2b7, and not "still in history"

Diagram

A history finding and a directory finding

The commit field is present only when history was walked.

History scan

Has. Commit and commit date

Means. A match in that commit

Does not. Appear without those fields

Directory scan

Has. File, line, and rule

Means. A match in the folder at scan time

Does not. Prove the match is in git history

Check yourself

1. A finding has a file and a rule and no commit. What scan produced it?

2. May you copy a commit from an older scan onto this finding?

3. What do you write when the paste does not say which mode ran?