Skip to content

fix: shell injection safety via github.ref_name in publish workflow - #10327

Merged
sheremet-va merged 1 commit into
vitest-dev:mainfrom
lloyd-c137:fix/gh-actions-script-injection
May 12, 2026
Merged

sheremet-va merged 1 commit into
vitest-dev:mainfrom
lloyd-c137:fix/gh-actions-script-injection

Conversation

@lloyd-c137

Copy link
Copy Markdown
Contributor

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

- run: npm i -g npm@^11.5.2 && pnpm run publish-ci ${{ github.ref_name }}

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

- run: npm i -g npm@^11.5.2 && pnpm run publish-ci "${{ github.ref_name }}"

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.

@netlify

netlify Bot commented May 12, 2026

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 62c27cf
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a02f32a14889900082df905
😎 Deploy Preview https://deploy-preview-10327--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sheremet-va

sheremet-va commented May 12, 2026 •

Copy link
Copy Markdown
Member

It's nice to have, but I don't think this is a real threat because:

  • v* tags could only be created by maintainers
  • this workflow requires manual approval because it's in the Release environment
  • it cannot be triggered in forks

@sheremet-va
sheremet-va merged commit dd0207f into vitest-dev:main May 12, 2026
12 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants