fix: Prevent shell injection in GitHub Actions workflows#495
Open
fix-it-felix-sentry[bot] wants to merge 2 commits intomainfrom
Open
fix: Prevent shell injection in GitHub Actions workflows#495fix-it-felix-sentry[bot] wants to merge 2 commits intomainfrom
fix-it-felix-sentry[bot] wants to merge 2 commits intomainfrom
Conversation
Fix security vulnerability where github context variables were used directly in run steps, which could allow code injection attacks. Changed to use intermediate environment variables with proper quoting. References: - Parent ticket: https://linear.app/getsentry/issue/VULN-1599 - Child ticket: https://linear.app/getsentry/issue/NEW-784 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a security vulnerability where GitHub context variables were used directly in
run:steps, which could allow attackers to inject malicious code into the workflow runner.Changes
.github/workflows/release-ghcr-version-tag.yml: Added environment variables forgithub.repository,github.ref_name, andgithub.shato prevent injection in the docker buildx command.github/workflows/fast-revert.yml: Added environment variables forsteps.token.outputs.token,github.repository,github.run_id,github.event.repository.id, andgithub.event.numberto prevent injection in the curl commandAll GitHub context data is now stored in intermediate environment variables and properly quoted when used in shell scripts, following security best practices.
Security Impact
Severity: High
The vulnerability could allow an attacker to:
References