Skip to content

fix(azure): prevent setupRef script injection - #183

Closed
fengmk2 wants to merge 1 commit into
mainfrom
propose-fix-for-setupref-command-injection
Closed

fengmk2 wants to merge 1 commit into
mainfrom
propose-fix-for-setupref-command-injection

Conversation

@fengmk2

@fengmk2 fengmk2 commented Oct 8, 2026

Copy link
Copy Markdown
Member

Motivation

  • Fix a high-severity template injection where parameters.setupRef was expanded directly into inline PowerShell and Bash script bodies, allowing crafted refs to break out of quoted strings and execute arbitrary commands on the agent.

Description

  • Change azure/setup-vp.yml to construct bootstrap/runtime download URLs at runtime from the environment variable SETUP_VP_SETUP_REF instead of interpolating ${{ parameters.setupRef }} into executable script source; the Windows branch uses $env:SETUP_VP_SETUP_REF and the Unix branch uses ${SETUP_VP_SETUP_REF}.
  • Keep the template mapping that exposes the parameter to the job via SETUP_VP_SETUP_REF so consumers can still control the ref without injecting into script text.
  • Add a regression test in src/azure/template.test.ts that asserts the template does not contain setup-vp/${{ parameters.setupRef }}/azure and does contain the env-based URL forms used by both prepare steps.

Testing

  • pnpm run check:fix and pnpm run typecheck completed successfully.
  • pnpm run test completed successfully (309 tests passing).
  • pnpm run build completed successfully and git diff --check reported no issues.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant