Skip to content

Fix: resolve Zizmor findings in vote step - #116

Merged
tykeal merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/zizmor-findings
Jun 23, 2026
Merged

tykeal merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/zizmor-findings

Conversation

@ModeSevenIndustrialSolutions

Copy link
Copy Markdown
Member

Summary

Resolves all 10 high-severity Zizmor
findings reported for action.yaml by the org-wide security audit
(6 × template-injection, 4 × github-env).

Problem

  • The Clear, Success, Failure and Cancelled steps interpolated the
    comment-only input directly into a bash if [[ ... ]] test
    (template-injection) and exchanged VOTE/STATUS between steps by
    writing to $GITHUB_ENV (github-env).
  • The Vote step interpolated gerrit-change-number and
    gerrit-patchset-number directly into a PATCH= shell assignment
    (template-injection).

Fix

  • Collapse the four mutually exclusive vote-type steps into the single
    Vote step, deriving the review labels and status locally from
    vote-type via a case statement. This removes the cross-step
    $GITHUB_ENV writes entirely.
  • Pass every templated value (vote-type, comment-only, change/patchset
    numbers, the github.* context values and the target host) through the
    step's env: block and reference each as a quoted shell variable, so
    nothing is interpolated directly into the run: body.
  • The downstream ssh -- "$TARGET_HOST" invocation is now quoted as well.

Behaviour is preserved; an explicit error is now raised for an unknown
vote-type instead of silently producing an empty vote.

Verification

uvx zizmor@1.25.2 --persona regular --min-severity medium gerrit-review-action
# No findings to report. Good job! (3 suppressed)

yamllint, check-yaml and Validate GitHub Actions pre-commit hooks pass.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the composite GitHub Action to remediate Zizmor security findings by removing expression interpolation from run: blocks and eliminating cross-step state passing via $GITHUB_ENV, consolidating vote logic into a single step.

Changes:

  • Collapses the previous vote-type-specific steps into a single Vote step using a case statement to derive labels/status locally.
  • Moves all templated/untrusted values into the step env: and references them via quoted shell variables.
  • Quotes the downstream ssh -- "$TARGET_HOST" invocation to prevent option/argument injection via the host value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread action.yaml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread action.yaml Resolved
Comment thread action.yaml Resolved
The Clear, Success, Failure and Cancelled steps interpolated the
comment-only input directly into bash and exchanged VOTE and STATUS
across steps via $GITHUB_ENV, while the Vote step interpolated the
change and patchset numbers into a shell assignment. Zizmor flagged
six template-injection and four github-env findings.

Collapse the four mutually exclusive steps into the Vote step and
pass every templated value through an env block, referencing each as
a quoted shell variable. This removes the $GITHUB_ENV writes and the
direct template interpolation while preserving behaviour.

Validate the change and patchset numbers are positive integers
(>= 1, no leading zeros) before they are concatenated into the remote
gerrit review command, so whitespace or shell metacharacters cannot
alter the command sent over ssh.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread action.yaml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@tykeal
tykeal merged commit a1c036a into lfreleng-actions:main Jun 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants