Skip to content

Fix zizmor code scanning alerts in action.yml - #309

Open
lucperkins wants to merge 1 commit into
mainfrom
fix/zizmor-code-scanning
Open

Fix zizmor code scanning alerts in action.yml#309
lucperkins wants to merge 1 commit into
mainfrom
fix/zizmor-code-scanning

Conversation

@lucperkins

@lucperkins lucperkins commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

Resolves all 15 open code scanning alerts, which were zizmor findings in action.yml:

  • 4 × template-injection: ${{ inputs.git-author-name }} and friends were interpolated directly into a run: script.
  • 11 × github-env: three steps wrote GIT_AUTHOR_*, GIT_COMMITTER_*, and GIT_COMMIT_MESSAGE to $GITHUB_ENV.

Changes

  • Merge the two conditional "set environment variables" steps into a single git-identity step that selects the GPG or input-provided identity in bash. Inputs are passed via env: rather than interpolated, and the result is written to $GITHUB_OUTPUT.
  • The commit-message step writes to $GITHUB_OUTPUT (steps.commit-message.outputs.message) using the same random-delimiter heredoc as before.
  • Consumers reference step outputs instead of env.*:
    • Run update-flake-lock receives GIT_AUTHOR_*/GIT_COMMITTER_* via env:. This matters because nix flake update --commit-lock-file is what creates the commit, and git honors those variables.
    • The Handlebars step receives all five GIT_* variables via env:. pedrolamas/handlebars-action builds its template context from { ...process.env }, so the documented {{ env.GIT_COMMIT_MESSAGE }} etc. in pr-body templates keep working unchanged.
    • Create PR's author/committer use the step outputs.
  • Drop an unused TARGETS: ${{ inputs.inputs }} env var from the old signed step.

Behavior note

Previously the GIT_* variables leaked via GITHUB_ENV into any steps after update-flake-lock in a caller's workflow. That was never documented (the README only lists them as pr-body template variables), so this PR does not preserve it. If we know of users relying on it, explicit action outputs would be the right replacement.

Verification

  • zizmor --config .github/zizmor.yml action.yml .github/workflows → no findings (was 15 high). The pedantic persona shows only one pre-existing superfluous-actions info.
  • YAML parses; prettier --check action.yml passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Improved commit identity handling for signed commits and configured author details.
    • Commit and pull request updates now consistently use the resolved author and committer information.
    • Improved transfer of multiline commit messages during workflow execution.
    • Pull request creation now reflects the selected commit identity more reliably.

Resolves all 15 open code scanning alerts (zizmor `template-injection`
and `github-env`):

- Stop interpolating `${{ inputs.git-*-name/email }}` directly into a
  `run:` script; pass them through `env:` instead.
- Replace all `GITHUB_ENV` writes with step outputs. The git identity is
  now computed in a single `git-identity` step (signed vs. unsigned) and
  the commit message in a `commit-message` step.
- Pass the `GIT_AUTHOR_*`/`GIT_COMMITTER_*` values as `env:` on the
  `Run update-flake-lock` step, since git honors them when
  `nix flake update --commit-lock-file` creates the commit.
- Pass `GIT_*` as `env:` on the Handlebars step so the documented
  `env.GIT_*` template variables in `pr-body` keep working (the action
  builds its `env` context from `process.env`).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09cd2947-c4a9-4a5b-8f4d-b516a0ec2114

📥 Commits

Reviewing files that changed from the base of the PR and between f21d5f4 and 2427f38.

📒 Files selected for processing (1)
  • action.yml

Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The action consolidates Git identity setup into one step. It publishes identity and commit message values as step outputs. Update and pull request creation steps consume these outputs.

Changes

Git identity output flow

Layer / File(s) Summary
Resolve Git identity outputs
action.yml
The git-identity step selects GPG or configured identities and publishes author and committer outputs. The update step passes these values through GIT_* variables.
Consume commit and identity outputs
action.yml
The commit message uses multiline step output syntax. PR-body interpolation and PR creation consume the resolved step outputs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 2427f

The change localizes Git identity and commit-message values to step outputs and environment variables while removing unsafe workflow interpolation and environment leakage; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: fixing zizmor code scanning alerts in action.yml.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/zizmor-code-scanning

Comment @coderabbitai help to get the list of available commands.

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