fix: prevent GitHub Actions expression injection via tag name in Release workflow#21
Merged
Conversation
The Prepare workspace snippet step interpolated ${{ env.GITHUB_REF_NAME }}
directly into the shell command, allowing a crafted tag name to execute
arbitrary commands on the runner and steal GITHUB_TOKEN. Pass the ref name
through an environment variable and reference it as a quoted shell variable
instead.
Co-authored-by: Cursor <cursoragent@cursor.com>
SRELETI
approved these changes
Jul 6, 2026
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
Fixes a critical GitHub Actions expression injection in the
Releaseworkflow (.github/workflows/release.yml).The
Prepare workspace snippetstep interpolated the tag name directly into a shell command using expression syntax:GitHub evaluates
${{ }}before the shell runs, pasting the raw tag name into the command line. Because theReleaseworkflow triggers onv*.*.*tag pushes and tag names can contain shell metacharacters (;, backticks,&&,|,$()), a crafted tag could execute arbitrary commands on the runner — with access to that job'sGITHUB_TOKENand any secrets in the environment.Fix
Bind the ref name to an environment variable and reference it as a quoted shell variable, so GitHub never substitutes untrusted text into the shell command:
This is GitHub's recommended remediation pattern for untrusted input in
run:steps. The value is now passed to the shell at runtime as inert data; metacharacters are treated literally.Test plan
Releaseworkflow still producesrelease_notes.txton a normal tag (e.g.v1.2.3).Made with Cursor