🐛 fix(ci): replace head_commit.message expression with git log (shell injection) #38
Reference in New Issue
Block a user
Delete Branch "fix/ci-commit-msg-shell-injection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Every CI run since PR #31 has failed at the same step:
Affected post-merge runs: #621 (PR #32), #622 (PR #33), #623 (PR #34), #624 (PR #35).
Root cause
The "Update badges and version" step did:
${{ ... }}is interpolated literally into the rendered shell script before bash parses it. Any of the following in a commit body breaks the next line:Test/coverage/badge work itself is fine — the failure is purely cosmetic at the post-test step. But it pollutes CI history and triggers cancellations on chained workflows.
Fix
Read the same information from
git loginstead — no shell-injection surface:This was already the fallback (added in PR #31 for
workflow_dispatch). Promoting it to be the only path eliminates the bug class entirely.Verification
paths-ignorefor the workflow includesdocumentation/**and*.md— does NOT include.gitea/**; this PR will trigger CI on its own merge → first signal of the fix working.${{ ... }}expansions feed shell variables in the workflow (the other 3 uses are insidecontains()job-level conditions which are evaluated server-side as booleans).git log -1 --pretty=%Bpath was already exercised on every merge since PR #31 (the fallback hit on workflow_dispatch but the syntax error fired before reaching it on regular pushes).Why it was missed
PR #31 fixed the empty-message case but kept the original expression as the primary path. The fall-through was for the harmless case (empty); the dangerous path (special-char body) was untouched. Verifier-skill style review (Dim C — test reliability) would flag this: "fix removes one branch of failure but leaves the other branch + adds no regression test for the failing case."
Follow-up worth tracking: add a CI smoke that asserts the workflow renders without
act --validateerrors on PRs touching.gitea/workflows/.