Skip to content

ci: drop the dead gitleaks PR-scan variable - #22

Merged
gwarf merged 1 commit into
mainfrom
fix/betterleaks-pr-commits-scan
Aug 20, 2026
Merged

ci: drop the dead gitleaks PR-scan variable#22
gwarf merged 1 commit into
mainfrom
fix/betterleaks-pr-commits-scan

Conversation

@gwarf

@gwarf gwarf commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Follow-up to #21, now that v10.0.0 is on main. Removes one dead variable and records why.

REPOSITORY_GITLEAKS_PR_COMMITS_SCAN has had no effect since #21 merged: v10 removed REPOSITORY_GITLEAKS in favour of REPOSITORY_BETTERLEAKS and ignores variables of removed linters with only a log notice.

The migration is not a rename. I tested REPOSITORY_BETTERLEAKS_PR_COMMITS_SCAN on v9.6.0, which ships both linters side by side:

Command: [betterleaks git --redact --verbose . --log-opts --no-merges --first-parent <base>^..<head>]
ERR [git] fatal: detected dubious ownership in repository at '/github/workspace'
ERR failed to scan Git repository

PR_COMMITS_SCAN moves betterleaks from project mode to git mode, and git mode aborts on ownership. Granting the exception through REPOSITORY_BETTERLEAKS_PRE_COMMANDS does not help. The pre-command demonstrably runs:

[Pre][REPOSITORY_BETTERLEAKS] run: [git config --global --add safe.directory /github/workspace] in cwd [/github/workspace]

and betterleaks fails identically afterwards. MegaLinter also sets safe.directory for GITHUB_WORKSPACE itself at startup, so the exception is not reaching whatever config the linter process actually reads. gitleaks never had this problem on the same workspace.

Adjacent open upstream issues, neither covering this case: oxsecurity/megalinter#8731 (gitleaks PR-scan docs lost in the transition) and oxsecurity/megalinter#8732 (betterleaks PR scan broken on Azure Pipelines).

Net effect: secret scanning stays unscoped in project mode. That works and is already what runs today, at the cost of scanning the whole workspace on each PR instead of only the PR commits. .gitleaksignore is read unchanged, so existing suppressions still apply.

The comment exists so a later bump does not retry the rename and rediscover this.

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ ACTION actionlint 1 0 0 0.03s
✅ ACTION zizmor 1 0 0 0 1.35s
✅ REPOSITORY betterleaks yes no no 0.92s
✅ REPOSITORY checkov yes no no 14.81s
✅ REPOSITORY git_diff yes no no 0.06s
✅ REPOSITORY osv-scanner yes no no 0.74s
✅ REPOSITORY secretlint yes no no 2.95s
✅ REPOSITORY syft yes no no 1.25s
✅ REPOSITORY trivy-sbom yes no no 0.82s
✅ SPELL lychee 1 0 0 0.08s
✅ YAML prettier 1 0 0 0 0.45s
✅ YAML v8r 1 0 0 1.4s
✅ YAML yamllint 1 0 0 0.52s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@gwarf gwarf changed the title ci: carry PR-commits-scan across the gitleaks to betterleaks rename ci: document why betterleaks cannot inherit the PR-commits scoping Aug 20, 2026
MegaLinter v10 removed REPOSITORY_GITLEAKS in favour of
REPOSITORY_BETTERLEAKS and ignores variables belonging to removed
linters with only a log notice, so REPOSITORY_GITLEAKS_PR_COMMITS_SCAN
has had no effect since the v10 bump landed.

The migration is not a rename. Setting
REPOSITORY_BETTERLEAKS_PR_COMMITS_SCAN switches betterleaks from project
mode to git mode, and its git mode aborts with "detected dubious
ownership in repository at '/github/workspace'". Granting the exception
through REPOSITORY_BETTERLEAKS_PRE_COMMANDS does not help: the
pre-command runs, MegaLinter also sets safe.directory for
GITHUB_WORKSPACE at startup, and betterleaks still fails, so the
exception is not reaching the config the linter process reads. Verified
on v9.6.0, which ships both linters side by side.

Secret scanning therefore stays unscoped in project mode, which works
and is what the current runs already do. Comment records the constraint
so a later bump does not retry the rename.
@gwarf
gwarf force-pushed the fix/betterleaks-pr-commits-scan branch from d64325e to 3b5dcd5 Compare August 20, 2026 10:45
@gwarf gwarf changed the title ci: document why betterleaks cannot inherit the PR-commits scoping ci: drop the dead gitleaks PR-scan variable Aug 20, 2026
@gwarf
gwarf merged commit 338e168 into main Aug 20, 2026
2 checks passed
@gwarf
gwarf deleted the fix/betterleaks-pr-commits-scan branch August 20, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant