fix: shell injection safety via github.ref_name in publish workflow by lloyd-c137 · Pull Request #10327 · vitest-dev/vitest (original) (raw)

Security Fix

Vulnerability: ${{ github.ref_name }} is interpolated directly into a run: shell command without quoting. Since github.ref_name corresponds to the git ref (tag/branch name), an attacker who can influence the ref name (e.g., via a crafted tag) can inject arbitrary shell commands.

Line: .github/workflows/publish.yml:44

Fix: Wrapped ${{ github.ref_name }} in double quotes to prevent shell word splitting and injection.

This follows GitHub security best practices: treat all context data as untrusted and quote or pass through env: variables when used in shell commands.

Discovered via automated CI/CD security analysis.