Harden Copilot cloud setup workflow#743
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the Copilot cloud agent setup workflow by switching to pinned runner/tool versions, caching NuGet at the repo-local packages/ directory, adding guardrails against installer builds, cloning helper repositories with shallow checkouts, adding step-level timeouts, applying least-privilege permissions (contents: read), and ignoring .env files in .gitignore.
Changes:
- Refactored
copilot-setup-steps.ymlto usebuild.ps1/test.ps1wrapper scripts (replacing baremsbuild), pin the runner towindows-2022anduvto0.6.x, add an installer-build guardrail, shallow-clone three helper repos, add 60-minute build/test timeouts, and setpermissions: contents: read. - Updated NuGet cache key and path to match the repo-local
packages/directory and includenuget.configin the hash. - Added
.env,.env.*, and.github/skills/**/.envignore rules to.gitignoreto reduce accidental secret commits.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.github/workflows/copilot-setup-steps.yml |
Major refactor: pinned runner/tooling, wrapper-script-focused inputs, guardrail step, shallow helper-repo clones, per-step timeouts, least-privilege permissions |
.gitignore |
Added .env, .env.*, and .github/skills/**/.env rules to block accidental secret commits |
| Write-Host "Running: ./build.ps1 ${{ inputs.build_args }}" -ForegroundColor Cyan | ||
| ./build.ps1 ${{ inputs.build_args }} |
There was a problem hiding this comment.
Direct interpolation of ${{ inputs.build_args }} into the run: script body (lines 198–199) is a script-injection risk. Although this workflow is workflow_call-only and its callers are in this repo, any caller workflow that itself accepts user input and forwards it to build_args would expose this path. The recommended GitHub Actions hardening pattern is to pass the input through an environment variable and then reference it in the script via $env:BUILD_ARGS:
env:
BUILD_ARGS: ${{ inputs.build_args }}
run: |
./build.ps1 $env:BUILD_ARGSThis prevents template injection because $env:BUILD_ARGS is never evaluated as workflow expression syntax—it is only resolved as a shell variable at runtime.
Accept windows risks
|
|
|
I'm not sure that liblcm should be copied here, we only need localizations for the installer build or for debugging localizations. |
jasonleenaylor
left a comment
There was a problem hiding this comment.
@jasonleenaylor reviewed 5 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on johnml1135).
Summary
uget.config
Notes
This change is