Skip to content

Fix shell injection vulnerability in GitHub Actions workflow - #225

Open
fix-it-felix-sentry[bot] wants to merge 1 commit into
masterfrom
fix/eng-7577-shell-injection-vulnerability
Open

Fix shell injection vulnerability in GitHub Actions workflow#225
fix-it-felix-sentry[bot] wants to merge 1 commit into
masterfrom
fix/eng-7577-shell-injection-vulnerability

Conversation

@fix-it-felix-sentry

Copy link
Copy Markdown

Summary

This PR fixes a high-severity shell injection vulnerability in the GitHub Actions workflow by moving GitHub context values to environment variables.

Changes

  • Modified .github/workflows/release-ghcr-version-tag.yml to use environment variables (REF_NAME and GITHUB_SHA) instead of directly interpolating github.ref_name and github.sha in run steps
  • Added proper quoting around environment variable references to prevent injection attacks

Security Impact

The previous implementation directly interpolated untrusted GitHub context data in shell commands, which could allow attackers to inject malicious code. This fix prevents such attacks by using intermediate environment variables.

References

Resolve code injection risk by using environment variables instead of
direct interpolation of github.ref_name and github.sha in run steps.

This prevents potential attackers from injecting malicious code through
untrusted GitHub context data.

Fixes: https://linear.app/getsentry/issue/VULN-1615
Fixes: https://linear.app/getsentry/issue/ENG-7577

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented May 1, 2026

Copy link
Copy Markdown

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b21b06a. Configure here.

- name: Tag release version
env:
REF_NAME: ${{ github.ref_name }}
GITHUB_SHA: ${{ github.sha }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reserved GITHUB_SHA variable cannot be overridden in env

Low Severity

GITHUB_SHA is a reserved default environment variable in GitHub Actions, and GitHub's docs state that GITHUB_* variables cannot be overwritten. The env: GITHUB_SHA declaration may be silently ignored, with $GITHUB_SHA in the run block resolving to the built-in default instead. This happens to have the same value for release events, so no breakage occurs today, but the override is misleading. A non-reserved name like COMMIT_SHA would be more reliable and accurate.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b21b06a. Configure here.

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.

0 participants