Skip to content

Fix GitHub Actions script injection in project-sync.yml - #448

Merged
nockawa merged 1 commit into
mainfrom
fix/actions-script-injection
Jul 2, 2026
Merged

nockawa merged 1 commit into
mainfrom
fix/actions-script-injection

Conversation

@nockawa

@nockawa nockawa commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Project Sync workflow interpolates untrusted github.event.* values (PR title, branch, issue node_id/number) directly into run: 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 parsed mode) for the Release NuGet as a command and the job failed with exit 127. A crafted title like $(…) or ; … would instead execute arbitrary commands in the runner, which holds the PROJECT_TOKEN secret.

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_REPOSITORY instead of ${{ github.repository }}. Expression results become inert environment values instead of being substituted into the script.

  • No ${{ … }} remains in any run: body (verified — all expressions are now in env:/if:).
  • YAML validated.
  • Behaviour unchanged for well-formed titles/branches.

Found while completing #422 (its PR #447 tripped the bug). Standalone infra fix — no linked issue.

🤖 Generated with Claude Code

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
@nockawa
nockawa merged commit 47b5f57 into main Jul 2, 2026
9 checks passed
@nockawa
nockawa deleted the fix/actions-script-injection branch July 2, 2026 21:16
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.

1 participant