Repository navigation
Fix GitHub Actions script injection in project-sync.yml - #448
Merged
Merged
Conversation
Untrusted github.event.* values (PR title, branch, issue node_id/number) were interpolated directly into `run:` shell bodies, so a PR title like `#422 ... ("strict mode") ...` broke the sync workflow (exit 127) and a crafted title (`$(...)`, `; ...`) could execute arbitrary commands in the runner, which holds the PROJECT_TOKEN secret. Pass all such values through `env:` and reference them as quoted shell vars; use the built-in `$GITHUB_REPOSITORY` instead of `${{ github.repository }}`. Applied uniformly across all five jobs. YAML validated; no `${{ }}` remains in any run body. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LWhJqY8FJznYVBjL6uPas
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.
Problem
The Project Sync workflow interpolates untrusted
github.event.*values (PR title, branch, issue node_id/number) directly intorun:shell bodies, e.g.:PR_TITLE="${{ github.event.pull_request.title }}"This is a GitHub Actions script-injection vulnerability: the expression is text-substituted into the script before bash runs, so shell metacharacters in the title are parsed/executed. It surfaced on PR #447, whose title contained
("strict mode")— bash parsedmode) for the Release NuGetas a command and the job failed with exit 127. A crafted title like$(…)or; …would instead execute arbitrary commands in the runner, which holds thePROJECT_TOKENsecret.Fix
Apply the GitHub-documented mitigation across all five jobs: pass every untrusted value through
env:and reference it as a quoted shell var ("$PR_TITLE",$ISSUE_NODE_ID, …); use the built-in$GITHUB_REPOSITORYinstead of${{ github.repository }}. Expression results become inert environment values instead of being substituted into the script.${{ … }}remains in anyrun:body (verified — all expressions are now inenv:/if:).Found while completing #422 (its PR #447 tripped the bug). Standalone infra fix — no linked issue.
🤖 Generated with Claude Code