fix(security): scan for secrets with the version the project pins - #15
Merged
Conversation
gitleaks-action builds its scan range as <first commit of the push>^..<last>. On the first push of any repository that first commit 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: first push red having scanned nothing, second push green. immich runs no secret scanner in CI β it relies on GitHub's own scanning and push protection β and runs every other tool through mise rather than a wrapper action. Both apply here: publish turns on GitHub's scanning where the plan allows it, and CI runs the gitleaks the project already pins for its commit hook, over the whole history. The action installed 8.24.3 while projects pin 8.30.0.
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 inyou/.github's security workflow rangitleaks/gitleaks-action. It now runsmise run secretsβ a task in the generated project's ownmise.toml, using the gitleaks that project already pins for its commit hook.scaffold publishadditionally turns on GitHub's native secret scanning and push protection where the plan allows.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. I had recorded this earlier in the session as "an intermittent gitleaks failure" and moved on; it is not intermittent, and the red was never the problem. The problem is a scan that did not happen reporting "no leaks found" β on exactly the push that first puts a project's whole history on GitHub.
v3.0.0is the action's latest release and is what we pinned, so there was nothing to bump to.Second, quieter: the action downloaded gitleaks 8.24.3 while generated projects pin 8.30.0. The commit 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 (mise run ci-publish,mise run //docs:deploy,mise //:release). Both halves apply:scaffold publishnow enables it.How it was verified
Generated a project, published it, and watched the real workflow:
scanned ~0 bytes1 commits scanned, ~103474 bytesghp_β¦token3 commits scanned, leaks found: 1A gate that cannot fail is worth nothing, so the second row is the one that matters. The verification repository and its package have been deleted.
you/.githubside merged as ttncode/.github#3;v1moved tov1.2.0.Checklist
mise run lintpassesmise run test-runnerpasses