fix: scan for secrets with the version the project pins - #3
Merged
Conversation
gitleaks-action builds its scan range as <first commit of the push>^..<last>. On a repository's first push that is the root commit, which has no parent, so git fails, the scan covers zero bytes, and the action still reports 'no leaks found'. Reproduced deterministically. It also installed gitleaks 8.24.3 while generated projects pin 8.30.0 for their commit hook. Running the project's own task scans the whole history with one version, the way every other tool here already runs.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The
gitleaksjob runsmise run secrets— the task and the pinned binary the generated project already has — instead ofgitleaks/gitleaks-action.Why
The action builds its scan range as
<first commit of the push>^..<last>. On a repository's first push that first commit is the root commit, which has no parent:Reproduced deterministically in an isolated repository: first push red having scanned nothing, second push green. The red is not the problem — the problem is a scan that did not happen reporting "no leaks found". If a secret were in those first commits, that is the run that should have caught it.
v3.0.0is the latest release and is what we pin, so there is nothing to bump to.Second, quieter: the action downloads gitleaks 8.24.3 while generated projects pin 8.30.0 for their commit hook. The hook and CI were scanning with different versions.
Why this shape
immich runs no secret scanner in CI at all — it relies on GitHub's own secret scanning and push protection — and runs every other tool through
mise run <task>rather than a per-tool wrapper action. Both halves apply here:scaffold publishnow turns GitHub's scanning and push protection on where the plan allows (blocking a secret at push time beats scanning after it lands).One pinned version, the whole history, no range arithmetic to get wrong.
Verified
With the pinned 8.30.0 against a repository whose root commit carries a planted token:
One commit scanned where the action scanned zero, and a real finding fails the job.