Skip to content

DO-1766: Remediate GitHub Actions template injection vulnerabilities#123

Merged
TheOrangePuff merged 4 commits intomainfrom
fix/DO-1766_remediate_gha_template_injection
Apr 2, 2026
Merged

DO-1766: Remediate GitHub Actions template injection vulnerabilities#123
TheOrangePuff merged 4 commits intomainfrom
fix/DO-1766_remediate_gha_template_injection

Conversation

@TheOrangePuff
Copy link
Copy Markdown
Member

Description of the proposed changes

Remediates GitHub Actions template injection vulnerabilities across all reusable workflows. All ${{ }} expressions that were directly interpolated inside run: script blocks have been moved to env: blocks and referenced via shell environment variables instead.

This prevents potential script injection where untrusted GitHub context fields (e.g. github.event.pull_request.number, github.sha) or workflow inputs could be used to inject arbitrary shell commands.

Affected workflows (10 files):

  • aem-sync-to-cloudmanager-repo.ymlinputs.debug, github.sha
  • changeset-check.ymlinputs.debug, inputs.is-yarn-classic
  • changeset-release.ymlinputs.debug, inputs.is-yarn-classic
  • magento-cloud-deploy.ymlgithub.sha, inputs.debug, secrets.cst-reporting-token
  • node-pr.ymlinputs.debug, inputs.is-yarn-classic, inputs.skip-cache, inputs.skip-*, secrets.ENV_VARS
  • nx-serverless-deployment.ymlinputs.debug, inputs.is-yarn-classic
  • php-quality-checks.ymlinputs.debug, inputs.use-custom-config
  • pwa-deployment.ymlinputs.debug, inputs.preview-mode, inputs.is-yarn-classic, github.event.pull_request.number
  • s3-deploy.ymlinputs.delete-flag
  • shopify-deploy.ymlinputs.deploy-production

Other solutions considered (if any)

Using zizmor: ignore[template-injection] annotations was considered but rejected in favour of actually fixing the underlying issue.

Notes to reviewers

The fix pattern is consistent across all files: move the ${{ }} expression into an env: block on the step, then reference it as ${ENV_VAR} in the shell script. For ternary expressions like ${{ inputs.debug && '--verbose' || '' }}, these have been replaced with explicit if conditionals in the shell script.

github.sha is replaced with the built-in GITHUB_SHA environment variable which GitHub Actions provides automatically.

ℹ️ When you've finished leaving feedback, please add a final comment to the PR tagging the author, letting them know that you have finished leaving feedback

Move all ${{ }} expressions out of run: script blocks into env: blocks
to prevent potential template injection attacks. This applies to inputs,
secrets, and github context fields across all reusable workflows.
@TheOrangePuff TheOrangePuff requested a review from a team as a code owner April 2, 2026 00:18
@TheOrangePuff TheOrangePuff force-pushed the fix/DO-1766_remediate_gha_template_injection branch from ea4f7a7 to cf90875 Compare April 2, 2026 00:24
ENV_VARS is intentionally passed by calling workflows without requiring
a GitHub Environment, as these are reusable workflow_call workflows.
@TheOrangePuff TheOrangePuff force-pushed the fix/DO-1766_remediate_gha_template_injection branch from b6a53d3 to 72af75b Compare April 2, 2026 00:34
AdamJHall
AdamJHall previously approved these changes Apr 2, 2026
@TheOrangePuff TheOrangePuff requested a review from AdamJHall April 2, 2026 04:07
@TheOrangePuff TheOrangePuff merged commit ecdf804 into main Apr 2, 2026
3 checks passed
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.

3 participants