Skip to content

fix: prevent script injection via workflow_dispatch releaseTag input (CWE-78) - #393

Merged
britaniar merged 1 commit into
Azure:mainfrom
britaniar:fix-cwe-78-workflow-script-injection
Jul 30, 2026
Merged

fix: prevent script injection via workflow_dispatch releaseTag input (CWE-78)#393
britaniar merged 1 commit into
Azure:mainfrom
britaniar:fix-cwe-78-workflow-script-injection

Conversation

@britaniar

Copy link
Copy Markdown
Contributor

Summary

Fixes CWE-78 (OS Command Injection / GitHub Actions script injection): the releaseTag workflow_dispatch input was interpolated unquoted directly into a bash run: block via ${{ inputs.releaseTag }}. GitHub Actions substitutes ${{ }} expressions textually into the script before the shell parses it, so a crafted releaseTag value (e.g. x"; curl ... | bash; #) could break out of the assignment and run arbitrary commands with the release job's Azure managed identity permissions (used later to az login --identity and push images to ACR/MCR).

Change

  • Pass inputs.releaseTag through an env: mapping (RELEASE_TAG_INPUT) instead of interpolating it directly into the script body.
  • Reference it as a quoted shell variable: RELEASE_TAG="$RELEASE_TAG_INPUT".
  • Replaced the deprecated ::set-output command with $GITHUB_OUTPUT as a drive-by cleanup since the line was already being touched.

Fixes

Fixes #391

…(CWE-78)

The releaseTag workflow_dispatch input was interpolated unquoted
directly into a bash run: block via ${{ inputs.releaseTag }}, which
GitHub Actions substitutes textually before the shell parses the
script. A crafted input value could break out of the assignment and
execute arbitrary commands with the release job's Azure managed
identity permissions.

Pass the input through an env: mapping and reference it as a quoted
shell variable instead of interpolating the expression directly. Also
replace the deprecated ::set-output command with $GITHUB_OUTPUT.

Fixes Azure#391

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.11%. Comparing base (9b87563) to head (10f04b7).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #393      +/-   ##
==========================================
+ Coverage   67.06%   67.11%   +0.05%     
==========================================
  Files          33       33              
  Lines        3783     3783              
==========================================
+ Hits         2537     2539       +2     
+ Misses       1072     1070       -2     
  Partials      174      174              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@britaniar
britaniar merged commit 556170b into Azure:main Jul 30, 2026
10 checks passed
@britaniar
britaniar deleted the fix-cwe-78-workflow-script-injection branch July 30, 2026 19:53
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.

CWE-78: Unquoted workflow_dispatch input enables script injection in build-publish-mcr.yml

2 participants