Update MegaLinter from v9 to v10 - #1071
Merged
Merged
Conversation
MegaLinter v10 removes REPOSITORY_GITLEAKS in favour of betterleaks, which this repository already uses, so the DISABLE_LINTERS entry for it is dropped. Left in place, v10 reports it as a removed item on every run. v10 also forwards EXCLUDED_DIRECTORIES to linters that scan the workspace themselves. For betterleaks it does so by wrapping .betterleaks.toml in a generated config that pulls ours in through "[extend] path". A rule-scoped allowlist does not survive that merge: the regexes are kept, but the targetRules binding to generic-api-key is lost, so both documented example secrets (the VNC console token and the Ceph keyring key) were reported as leaks and the job failed. Dropping targetRules keeps the allowlist effective through the generated config, so the forwarding can stay enabled as v10 intends. The two entries are exact literal strings, so restricting them to a single rule added no protection. A near-identical Ceph key differing in its last two payload characters is still reported, which confirms detection is unchanged. Verified with a full documentation-flavor v10 run over the whole codebase: all 16 linters pass. The only finding left is the pre-existing, non-blocking lychee 404 on the GitLab no_proxy link. Unrelated to CI, but worth knowing for local runs: MegaLinter publishes images to ghcr.io only since v9.5.0, so pull ghcr.io/oxsecurity/megalinter-documentation:v10. Docker Hub has no v10 tag and its v9 tag is frozen at 9.4.0. The GitHub Action reference used by the workflow is unaffected. SecurityImpact Assisted-by: Claude:claude-opus-5[1m] Signed-off-by: Jan Klare <klare@osism.tech>
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
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.

Updates the MegaLinter GitHub Action from
v9tov10, together with the two configuration changes the new major version requires.What would have broken
I ran v9.6.0 and v10.0.0 side by side against identical clean clones of
main(documentation flavor,VALIDATE_ALL_CODEBASE=true) to separate new failures from pre-existing ones.REPOSITORY_BETTERLEAKSfailed the build on v10. Both documented example secrets were reported as leaks — the VNC console token inmigration-vmware-esxi.mdand the Ceph keyring key inceph/index.mdx— even though.betterleaks.tomlallowlists them. Green on v9.6.0, red on v10.The cause is v10's new forwarding of
EXCLUDED_DIRECTORIESto linters that scan the workspace themselves. For betterleaks it stops passing our config directly and instead generates a wrapper that pulls ours in:Our allowlist regexes do survive that merge — but the
targetRulesbinding togeneric-api-keydoes not. I confirmed this by testing three shapes of the allowlist against a child config mimicking the generated one:[[allowlists]]+targetRules(previous)[allowlist]singular, notargetRules[[allowlists]]plural, notargetRulesThe last two differ from the first by exactly one line, so
targetRulesis the culprit — not the plural/singular form and not allowlist merging in general. Dropping it fixes the failure and lets the forwarding stay enabled as v10 intends, rather than switching it off withREPOSITORY_BETTERLEAKS_FORWARD_EXCLUDED_DIRECTORIES: false.REPOSITORY_GITLEAKSno longer exists. v10 removed it in favour of betterleaks and prints a notice on every run for configurations still referencing it. The migration itself was already done —.betterleaks.tomlexists and betterleaks was already running under v9.6 — so only the staleDISABLE_LINTERSentry needed removing.On widening the allowlist scope
The two entries are exact literal strings, so restricting them to one rule added no real protection. To be sure detection is intact, I took the real Ceph key, mutated its last two payload characters, and betterleaks still reports it. Only the two exact documented literals are exempt.
The alternative was a
.gitleaksignorewith fingerprints, which does work under v10's defaults, but each entry pins a line number: inserting two lines above the example inceph/index.mdxbrought the leak straight back. In a docs repo that would fail on unrelated PRs, so I did not go that way.Verification
Full v10 documentation-flavor run over the whole codebase with these changes: exit 0, all 16 linters pass, forwarding confirmed active for betterleaks, checkov and secretlint. The only remaining finding is the pre-existing, non-blocking lychee 404 on the GitLab
no_proxylink inproxy.md, which is unrelated to this change.Two notes, no action needed here
ghcr.io/oxsecurity/megalinter-documentation:v10; Docker Hub has no v10 tag and itsv9tag is frozen at 9.4.0. The Action reference used by the workflow is unaffected.LINTER_TIMEOUT_SECONDS: 300. The slowest linter here is checkov at ~19s, so there is plenty of headroom;SPELL_LYCHEE_TIMEOUT_SECONDSis the knob if lychee ever gets slow in CI.targetRulesbeing silently ignored under[extend]looks like a betterleaks/gitleaks bug that MegaLinter's wrapping merely exposes. Happy to report it upstream if you think it is worth filing.🤖 Generated with Claude Code