Repository navigation
Description
Summary
The hygiene job's secret scan is failing on open PRs for a finding that belongs to a
branch those PRs do not contain. As of this writing that is every PR CI runs, plus main's
next push. The finding itself is a false positive.
Reproduction
.github/workflows/ci.yml:137-144 runs the scan with scan-mode: git. In that mode
gitleaks walks the commits reachable from all refs in the clone, not the checked-out
ref. actions/checkout with fetch-depth: 0 fetches every branch, so each PR's scan
covers unrelated in-flight branches.
Reproduced locally against gitleaks 8.30.1, the version CI installs:
# only origin/main plus the PR branch present
$ gitleaks git --config .gitleaks.toml --redact
INF 1977 commits scanned.
INF no leaks found
# after git fetch origin '+refs/heads/*:refs/remotes/origin/*'
$ gitleaks git --config .gitleaks.toml --redact
INF 2018 commits scanned.
WRN leaks found: 1
Same config, same binary, same checked-out commit. The only variable is which other
branches happen to be in the clone.
The finding
RuleID : generic-api-key
File : plugins/claude-config/lib/resolve-convention-home.sh
Line : 248
Commit : f7aec1549dec60407a24a7d8ea720696b7b099af
Branch : chore/retired-conventions-mechanism
Match : CLAUDE_TOKEN=""
The matched text is an empty shell variable initialisation, next to its sibling on the
line above:
AGENTS_STATE="none"; AGENTS_TOKEN=""
CLAUDE_STATE="none"; CLAUDE_TOKEN=""These are parser state variables for a file scan. There is no credential here, and the
assigned value is the empty string, so nothing is disclosed. generic-api-key fired on
the identifier alone.
Neither the file nor the line exists on main, which is why main's last push run
(33562372229, f43bd07, 21:40Z) was green and PR runs started failing at 22:12Z: the
commit landed on its branch at 21:47Z, between the two.
Two separate defects
- The false positive.
CLAUDE_TOKEN=""is a state variable, not a secret. - The blast radius. A finding on any branch fails hygiene on every other branch. A
contributor sees a red check citing a file their PR never touched, which is the part
that actually costs time. Defect 1 is a one-line fix on one branch; defect 2 will do
this again on the next false positive.
Options
For the finding, per .gitleaks.toml's own policy ("Intentional findings use a
repository-owned .gitleaksignore or inline gitleaks:allow comment"), an inline
# gitleaks:allow on that line in the owning branch is the narrower of the two and does
not need a fingerprint that goes stale when the commit is rebased.
For the blast radius, scan-mode: git could be scoped to the range under review
(--log-opts over the PR's own commits) so a PR is judged on its own diff, with
full-history scanning kept on the main-branch push run where it still catches
history rewrites. That is a change to the shared ci-workflows action's contract or its
inputs, so it wants its own decision rather than a drive-by edit.
Not fixed here
Neither fix belongs in an unrelated PR: the false positive is on a branch whose author
should decide the annotation, and the scoping change touches shared CI. Filed so the
red check has an owner instead of being re-diagnosed by whoever hits it next.
Activity
kyle-sexton commentedon Sep 1, 2026
What the rule actually matched, and why an inline allow is not enough on its own
Two corrections to the original report, both from reproducing against gitleaks 8.30.1.
The "secret" is the next line
Unredacted, the finding spans two lines:
generic-api-keykeys on theTOKENidentifier and then reaches forward forsomething quoted-or-assigned to call the value. What it settled on is
CLAUDE_SHIM=0, the integer flag on the following line. So the finding is not"an empty assignment looks like a credential" as first described; it is the
keyword on line 248 capturing an unrelated line 249. The assigned value on 248 is
still the empty string, and nothing is disclosed either way.
Worth noting for anyone reproducing: the two lines in isolation do not fire.
A minimal three-line fixture scans clean. The rule only triggers with the real
file's surrounding content, so a reduced repro will mislead you into thinking it
is already fixed.
An inline
gitleaks:allowdoes not clear a finding already in historyThis is the part that changes the fix. Measured on a fixture holding the real
file, with the annotation added in a later commit:
git(what CI runs)dir(working tree)scan-mode: gitreads commit patches, not the checked-out file, so annotating ina follow-up commit leaves every already-pushed commit flagged for as long as it
stays reachable.
What this means for the two fixes
missed: without it, the squash-merged commit that lands on
maincarries thebare line, and
maingoes red permanently rather than transiently. Preparedas a 6-line commit (annotation plus a comment recording why), verified
dirmode clean with it and flagged without, resolver suite 61/61, shellcheck clean.
Not pushed: it belongs to feat: ship the retired-conventions mechanism (Phase 2b) #3597's branch, and pushing to a branch other than
the one this session was assigned needs its owner's say-so.
the unannotated commit from every scanned ref does that, which means either
rewriting that branch's single commit or waiting for feat: ship the retired-conventions mechanism (Phase 2b) #3597 to squash-merge and
its branch to be deleted.
Judging a PR on its own commit range would have made this a non-event: the
finding would have failed exactly one PR, the one that introduced it, instead
of every open PR in the repository.
Generated by Claude Code
kyle-sexton commentedon Sep 1, 2026
The per-commit fix does not converge, and there is now evidence
The annotation landed on
chore/retired-conventions-mechanism(f7aec154amended inplace to
f3d0a223, author preserved, delta exactly the six lines). That should havebeen the end of it. It was not, for two reasons that between them make the case for the
scoping change rather than more annotations.
The commit stayed reachable
chore/bespoke-conversionwas stacked directly on the pre-amend commit, so the oldf7aec154survived on that ref. It was then merged forward rather than rebased(
38fcb185, "Merge remote 2b (gitleaks annotation) keeping the CI repairs"), which isthe right call for a branch someone else has checked out and which correctly preserved
CI repairs made in parallel. It also means a merge keeps the unannotated commit
reachable by construction.
f7aec154is currently reachable from three refs:Annotating the source does not retract a commit. Only rewriting every ref that carries
it does, and on a stack with concurrent work that is a fight you keep re-fighting.
The finding multiplied
The scan now reports two, not one:
The second is the same file vendored into another plugin on
chore/pilot-plugin-quality,carrying the same
CLAUDE_TOKEN/CLAUDE_SHIMpair. This file is explicitly ashared-source candidate ("the first consuming plugin adds both in the same change that
copies it"), so every future consumer that copies it before the annotation reaches them
adds another finding, each on its own branch, each failing hygiene for every other branch.
What this changes
The scoping change is not the tidier of the two options, it is the only one that
terminates. Judging a PR on its own commit range would have made both of these findings
fail exactly the branch that introduced them, where the author can see and fix them,
instead of failing every open PR in the repository and sending whoever hits it first on
a cross-branch archaeology run.
Until that lands,
hygienestays red repo-wide, including on PRs whose diffs touch noneof this. That is worth knowing before someone reads a red check as their own defect.
The remaining per-commit cleanup belongs to the branches that own those commits, and is
being actively worked there.
Generated by Claude Code
fix(ci): ignore the two cross-branch gitleaks false positives
kyle-sexton commentedon Sep 2, 2026
PR #3618 (commit
220bd3bc) adds a repository-owned.gitleaksignorerecording both current fingerprints:This is the third mechanism
.gitleaks.toml's own policy names, and unlike the inline annotation it does clear findings already in history: gitleaks reads the ignore file from the checked-out tree, so any branch carrying it scans clean regardless of which refs hold the unannotated commits. Verified with gitleaks 8.30.1 over all 29 remote refs: 2 leaks without the file, 0 with it. Other open PRs pick it up by merging main once #3618 lands.This unblocks PRs; it does not close this issue. The scoping change (judging a PR on its own commit range) is still the fix that terminates, since each future false positive needs a new fingerprint here until it lands. The entries can be deleted once their commits stop being reachable.
Generated by Claude Code
feat(education): add the eli5 visual lane and de-brand explain (#3595)
kyle-sexton commentedon Sep 6, 2026
This was generated by AI during triage.
Merged from #3610 (duplicate)
#3610 reported the same defect pair from the other end: the same
generic-api-keyfinding onplugins/claude-config/lib/resolve-convention-home.sh:248(commitf7aec154), and the same blast radius fromscan-mode: gitwalking every fetched ref. Closing it as a duplicate of this issue, which carries the fuller diagnosis (the two-line match region, and thegitvsdirscan-mode table showing why an inline annotation cannot retract a finding already in history). Carrying over what #3610 had and this issue did not:Failing run: https://github.com/melodic-software/claude-code-plugins/actions/runs/33567373731/job/100053589384 (commit count on that run: 1,987 scanned against a PR head history of 1,976, which is the all-refs reach stated numerically).
Acceptance criteria (from #3610):
hygienejob's gitleaks step passes on a pull request whose diff does not touchplugins/claude-config/lib/resolve-convention-home.sh..gitleaks.toml.Follow-ups #3610 was tracking, which this issue now owns:
.gitleaksignorefingerprint entry once the branch it names squash-merges or is deleted; the commits become unreachable and the entry becomes dead config. The file states that condition inline.gitleaks:allowmarker to theplugins/plugin-quality/lib/resolve-convention-home.shcopy onchore/pilot-plugin-quality, which is still unmarked. Without it, each new commit touching that line mints a fresh fingerprint no entry covers.One empirical result from #3610 worth keeping, since it rules out the cheapest-looking fix: renaming the flag does not work. Tested against gitleaks 8.30.1 with this repo's config,
CLAUDE_SHIM_PRESENT=0still fires, and so does a blank line between the flag and the*_TOKENinitializations. Only removing the*_TOKENvariables or marking the line suppresses it.Also on the record from #3610:
.gitleaksignoreis registered inscripts/affected-tests-no-suite.txtpaired with the hygiene lane, so a future change to it fails the affected-tests contract rather than mapping to no suite.Generated by Claude Code
kyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Human-gated. Open decision: whether to scope gitleaks
scan-mode: gitto the PR's own commit range (keep full-history on main push) vs leave as-istest(ci): prove the gitleaks event range ignores other refs (#3599)
ci: scope gitleaks git scan to the event's commits (#3599) (#5131)
kyle-sexton commentedon Sep 29, 2026
Reopened. This comes from the 2026-09-29 audit of the Cursor agent run. The labels
needs-human,work-class: structuralandpriority: lowstay; this issue closes on merge of the fix PR, not before.Findings
scripts/gitleaks-scoped-scan.sh, nine hours after the owner's own ci-workflows#629 was closed and v0.30.0 shipped thelog-optsinput that the composite needed for exactly this.before^..after, and a dispatch scanned-1.Decision
The owner authorized, in a Claude Code session on 2026-09-29: re-pin the composite to v0.30.x with event-scoped
log-opts, restore a full-history scan on push to main, and delete the fork. This comment records that as the answer to the third acceptance criterion carried over from #3610 ("a decision is recorded on whether the scan is scoped"). #5003's parked-until-funded text is not a decision and is not restated here.Fix
PR #5316 does exactly that: pin
35880dcb(v0.30.1),scan-mode: gitwith emptylog-opts(pull_request scans<base>..HEAD, push scansHEAD, dispatch scans--all), the fork and its test deleted, and the two04f4bcd5fingerprints restored in.gitleaksignorebecause that commit is in main's history.Acceptance mapping
resolve-convention-home.sh: shown by ci: re-pin gitleaks composite, extend the Windows lane, wire unwired suites #5316's ownlintrun ('Scan for secrets')..gitleaks.toml: holds; the file is untouched.#5316 says
Closes #3599; the issue closes on merge.Follow-ups carried over from #3610
.gitleaksignoreentries: removed in ci: re-pin gitleaks composite, extend the Windows lane, wire unwired suites #5316 (five lines for commits no origin ref reaches; the two04f4bcd5lines stay).# gitleaks:allowon origin/main (plugins/plugin-quality/lib/resolve-convention-home.sh:259).One consequence for the owner
A manual dispatch of
ciscans every ref (the composite's documented--alldefault). On 2026-09-29 that reports 8 findings on other refs, six of them on other PR heads. Pull requests and pushes are unaffected.kyle-sexton commentedon Sep 29, 2026
Correction to the section "One consequence for the owner" in the earlier comment on this issue (#3599 (comment)). That section said a manual dispatch of
ci"reports 8 findings on other refs, six of them on other PR heads". That was wrong for a CI run.What a dispatch actually does
cirun 36577675603, joblint, step "Scan for secrets",log-optsunset so it scans--all) scanned 3192 commits and reportedno leaks found.gitleaks git . --log-opts="--remotes=origin --tags", run from the branch worktree so the branch's.gitleaksignoreapplies) scanned 3185 commits across 59 refs and exited 0, no leaks.Where the 8 findings came from
They came from a local scan with
--log-opts=--allin a clone that also holdsrefs/remotes/pr/*: 3047 local-only refs to closed and open pull request heads fetched into the local clone. A CI clone holds only origin's branches and tags, so it does not have those refs. Repeating the local all-refs scan today reports 11 findings (more PR heads have been fetched since). Every one is in a commit that only arefs/remotes/pr/*ref reaches: PR heads #5131, #5109, #5086, #5080, #4518, #4334 and #66. None is reachable from an origin branch or tag.So a manual dispatch of
ciis not expected to fail because of other refs, and the comment above the step inci.ymlno longer says it reports findings on other branches. A finding would show up in a dispatch only if an origin branch or tag carried one; none does today.Acceptance criterion 1, result
PR #5316's own
lintrun (run 36579146249, head5ca5fe296,pull_requestevent): "Scan for secrets" concludedsuccess, 8 commits scanned (<base>..HEAD),no leaks found. Criterion 1 is met; criteria 2 and 3 are unchanged from the earlier comment, soCloses #3599stands.fix(bash-format): cover the gitignored option in setup skill and READ…