Skip to content

fix: route workflow_dispatch inputs through env vars to prevent template injection (template-injection) #1532

Description

@planetf1

Summary

Tracked from #331 (zizmor CI gate). PR #1530 introduced zizmor enforcement and found that dispatch-to-contribs.yml uses ${{ github.event.inputs.version }} directly inside run: blocks, which is a template injection vector.

The workflow is workflow_dispatch and release-triggered only — no external attacker can trigger it without maintainer write access. The practical risk is low (requires insider intent or a compromised maintainer account), but the fix is mechanical and eliminates the issue entirely.

Affected locations

File Lines Expression
dispatch-to-contribs.yml 33–34 ${{ github.event.inputs.version }} in version-resolve run: block
dispatch-to-contribs.yml 59 ${{ steps.version.outputs.version }} in dispatch run: block (low confidence)

Fix

Route template expressions through environment variables per the AGENTS.md convention:

# Before (vulnerable)
run: |
  if [ -n "${{ github.event.inputs.version }}" ]; then
    VERSION="${{ github.event.inputs.version }}"

# After (safe)
env:
  INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
  if [ -n "${INPUT_VERSION}" ]; then
    VERSION="${INPUT_VERSION}"

zizmor --fix can generate the corrected form automatically.

Definition of done

  1. Route all template expressions in run: blocks through env: vars
  2. Remove the template-injection entries from .github/zizmor.yml
  3. zizmor reports no template-injection findings in dispatch-to-contribs.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreHousekeeping: renames, comment fixes, dependency bumps, repo hygienep2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.securityCVE or vulnerability-driven change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions