ci: fix the three MegaLinter failures on main - #20
Merged
Conversation
Run 31520588750 failed on zizmor, shellcheck and betterleaks. - zizmor: online audits need a GitHub token, and MegaLinter strips GITHUB_TOKEN from linter subprocesses unless whitelisted. Whitelist it so ref-confusion and known-vulnerable-actions keep running. - shellcheck: msmtpq and msmtp-queue are vendored upstream and account for 9 of the 12 findings; exclude them. Silence SC1091 in the three daryl-* wrappers, whose sourced file only exists at runtime. - betterleaks: user.signingkey is a public GPG key fingerprint, not a secret; mark it allowed.
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts
|
With the token in place zizmor completes its audits for the first time and reports 8 pre-existing findings that the earlier abort had masked. - unpinned-uses (5x, high): pin every action to a commit SHA with the major tag kept as a trailing comment. dependabot is already configured for github-actions, so it will keep the pins current. - artipacked (1x): set persist-credentials: false on checkout. Both fix-applying steps authenticate on their own, so nothing downstream needs the token left in .git/config. - template-injection (2x): pass the create-pull-request step outputs through env vars instead of expanding them into the shell source.
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.

Fixes the MegaLinter failure on
main(run 31520588750, commit 519b549). Three linters were red; each had a distinct cause. Fixing the first one unmasked a fourth batch of findings, handled in the second commit.1.
ACTION_ZIZMOR— 1 errorzizmor's
ref-confusionaudit calls the GitHub API and got401 Unauthorized, so it aborted withfatal: no audit was performed.GITHUB_TOKENis already in the job env, but MegaLinter sanitises secret-shaped variables out of linter subprocesses unless explicitly whitelisted.Fix:
ACTION_ZIZMOR_UNSECURED_ENV_VARIABLES: GITHUB_TOKEN, which is what MegaLinter's own error message recommends.Trade-off worth stating: this hands the job token to a third-party linter binary inside the container. The alternative,
ACTION_ZIZMOR_ARGUMENTS: --no-online-audits, would keep every offline audit and give up onlyref-confusionandknown-vulnerable-actions. I went with the token because the job token here iscontents: readon a public repo andknown-vulnerable-actionsis worth keeping. Note that the alternative would not have made the job green on its own, since the findings in section 4 below are all offline audits.2.
BASH_SHELLCHECK— 12 errorsNine of the twelve are in
home/private_dot_local/bin/executable_msmtpq, which is vendored upstream (msmtpq suite, Chris Gianniotis, GPLv3) — SC2218, SC2046, SC2064, SC2320, SC2174, SC2329. Not ours to patch, and patching it would conflict on every upstream sync. Excluded, along with its siblingexecutable_msmtp-queue, viaBASH_SHELLCHECK_FILTER_REGEX_EXCLUDE.The other three are SC1091 in
daryl-gemini,daryl-gooseanddaryl-gpt: they source~/.config/daryl/mail-env.sh, which only exists at runtime on a provisioned host. Fixed properly with a# shellcheck source=/dev/nulldirective rather than an exclusion.Left alone deliberately:
shfmtalso runs over the two vendored scripts and rewrites them. It is green today, so it is out of scope here, but it will produce upstream-sync churn — worth excluding separately if that ever bites.3.
REPOSITORY_BETTERLEAKS— 1 errorgeneric-api-keymatchedsigningkeyinhome/dot_gitconfig.user.tmpl:8. The value is a public GPG key fingerprint, which is exactly the sort of thing you publish. Marked with an inlinebetterleaks:allowplus a comment saying why.gitleakspasses on the same file; betterleaks is the newer sibling linter with a wider generic rule.4.
ACTION_ZIZMORagain — 8 pre-existing findings, previously maskedOnce zizmor could authenticate it ran to completion for the first time and reported 8 real findings in this workflow. They were always there; the abort in section 1 hid them. Second commit fixes all of them.
unpinned-uses, 5x, high. Everyuses:was on a floating major tag. Pinned to a commit SHA with the major kept as a trailing comment..github/dependabot.ymlalready tracksgithub-actionsdaily, so it will keep the pins current — no manual upkeep. Note these pin the currently referenced majors (checkout@v6,megalinter@v9); no version bumps are smuggled in here, dependabot can propose those separately.artipacked, 1x.actions/checkoutleft the token in.git/configfor every later step. Setpersist-credentials: false. Both fix-applying steps authenticate on their own (create-pull-requestvia itstoken:input, andAPPLY_FIXES_MODEispull_requestso thegit-auto-commit-actionpath is inert), so nothing downstream needs it. There is a comment in the workflow flagging that flippingAPPLY_FIXES_MODEtocommitwould need this revisited — that is the one coupling to keep in mind.template-injection, 2x.${{ steps.cpr.outputs.* }}expanded straight into arun:block. Moved toenv:so the values reach the shell as data, not source.Verification
shellcheck --external-sourceson the threedaryl-*scripts: clean, exit 0. Same run againstexecutable_msmtpq: still exit 1 with 49 lines of findings, confirming the exclusion is what clears it and not something else.git config --get user.signingkeyagainst the edited stanza returns46BDC6B3...with the trailing# betterleaks:allowstripped, so the comment does not corrupt the value.zizmor --no-online-auditson the edited workflow:No findings to report, exit 0.actionlint: clean, exit 0.One gap worth naming: this PR runs with
VALIDATE_ALL_CODEBASE: false, so shellcheck only lints changed files and the msmtpq exclusion is not exercised by the PR run — hence the local check above. Full-codebase validation happens on the push tomainafter merge.