Skip to content

Commit c09b7cb

Browse files
lilyshen0722claude
andcommitted
fix(ci): PR secret scans covered 0 commits; name the commits instead of a --remotes glob
`--remotes=origin/main` is a git glob that becomes origin/main/*, so it matched nothing. On a push the scan still worked, because `--branches` held the checked-out branch, but a pull request checks out a detached merge commit with no local branch, and every PR scan reported "0 commits scanned, no leaks found": #2375, #2368 and #2389 all did. That is how #2213's fixture passed review and only went red on main. Scan HEAD (the PR merge commit, or the pushed branch) plus origin/main and origin/v1.0.x by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015eTFc9yqm2vKZiUyvLuBT4
1 parent 00d3ded commit c09b7cb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎.github/workflows/secret-scan.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
run: |
3939
# Scan the full history of our branches (not --all, which includes
4040
# submodule git objects from _external/clawdbot).
41-
# ~500 commits, ~15s. Catches historical leaks in our own code.
41+
# ~2,600 commits, ~20s. Catches historical leaks in our own code.
42+
#
43+
# Name the commits; don't pattern-match them. `--remotes=origin/main`
44+
# is a glob that git extends to origin/main/*, so it matched nothing.
45+
# A push still scanned, through the checked-out branch in --branches,
46+
# but a pull request checks out a detached merge commit with no local
47+
# branch, and every PR scan reported "0 commits scanned" and passed.
48+
# HEAD is that merge commit on a PR, and the pushed branch on a push.
4249
gitleaks detect --source . --config .gitleaks.toml --redact -v \
43-
--log-opts="--branches --remotes=origin/main --remotes=origin/v1.0.x"
50+
--log-opts="HEAD origin/main origin/v1.0.x"

0 commit comments

Comments
 (0)