fix(ci): migrate from deprecated gitleaks to betterleaks - #117
Merged
sonupreetam merged 2 commits intoJul 30, 2026
Conversation
sonupreetam
marked this pull request as ready for review
July 30, 2026 11:38
sonupreetam
requested review from
beatrizmcouto,
hbraswelrh,
jflowers and
yvonnedevlinrh
July 30, 2026 11:38
REPOSITORY_GITLEAKS is deprecated in MegaLinter v9.6.0 and will be removed in a future major release. Gitleaks has been superseded by betterleaks, a faster and more accurate secrets scanner by the same author. PR complytime#114 added a .gitleaks.toml with a path allowlist for .content-lock.json, but MegaLinter's gitleaks integration passes its own built-in config via -c /action/lib/.automation/.gitleaks.toml, which overrides local config discovery. The repo's .gitleaks.toml was never loaded — the false positive persisted on every PR that includes the "complyapi" entry (e.g. PR complytime#86 re-run on Jul 30). This commit: - Replaces REPOSITORY_GITLEAKS with REPOSITORY_BETTERLEAKS in .mega-linter.yml - Adds .betterleaks.toml with an Expr prefilter that skips .content-lock.json (commit SHA map, not secrets) - Removes the now-unused .gitleaks.toml Refs complytime#86 Signed-off-by: sonupreetam <spreetam@redhat.com>
sonupreetam
force-pushed
the
fix/gitleaks-config-not-loaded
branch
from
July 30, 2026 11:44
9aae95f to
a1c64d4
Compare
Betterleaks scans the full git tree in project mode, unlike file-based linters that respect ADDITIONAL_EXCLUDED_DIRECTORIES. Add node_modules/ to the prefilter to skip vendored dependencies that produce false positives not previously flagged by gitleaks. Refs complytime#86 Signed-off-by: sonupreetam <spreetam@redhat.com>
Member
Author
|
Hey @yvonnedevlinrh, thanks for the diagnosis in #114, it was spot on (the "complyapi" key + 40-char hex value triggering generic-api-key). Unfortunately the fix didn't take effect, MegaLinter's gitleaks runner passes its own built-in config via This PR which migrates from the deprecated REPOSITORY_GITLEAKS to REPOSITORY_BETTERLEAKS (as MegaLinter recommends) with a proper prefilter config. Happy to have you review it since you're familiar with the context. |
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.
Summary
Migrates the secrets scanner from the deprecated
REPOSITORY_GITLEAKStoREPOSITORY_BETTERLEAKSand properly configures the.content-lock.jsonfalse positive suppression.
Why the previous fix (PR #114) didn't work
PR #114 added a
.gitleaks.tomlwith apathsallowlist for.content-lock.json. However, MegaLinter's gitleaks integration invokes:The
-cflag passes MegaLinter's built-in config (inside the container),which overrides gitleaks' local config discovery. The repo's
.gitleaks.tomlwas present in the workspace but never loaded. This is confirmed by the
PR #86 CI re-run on Jul 30
which still fails with the same 2
generic-api-keyfindings.Why migrate to betterleaks instead of patching gitleaks
MegaLinter v9.6.0 emits this deprecation warning on every run:
Rather than patching a linter that will be removed, this PR migrates to the
recommended replacement.
Changes
.mega-linter.yml: ReplaceREPOSITORY_GITLEAKSwithREPOSITORY_BETTERLEAKS; removeREPOSITORY_GITLEAKS_CONFIG_FILE.betterleaks.toml(new): Expr-basedprefilterskips.content-lock.jsonbefore regex matching — equivalent to the old pathallowlist but using betterleaks' native syntax
.gitleaks.toml(deleted): No longer neededRelated Issues
Review Hints
(repo)
prefiltermust appear before[extend]in TOML (keys after a tableheader are parsed as part of that table)
.betterleaks.tomlforREPOSITORY_BETTERLEAKS