fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks#1088
fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks#1088simonkurtz-MSFT wants to merge 11 commits intogithub:stagedfrom
Conversation
…in attacks Co-authored-by: simonkurtz-MSFT <84809797+simonkurtz-MSFT@users.noreply.github.com>
…-tag-usage fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks
There was a problem hiding this comment.
Pull request overview
Pins GitHub Actions uses: references to immutable commit SHAs (with readable version comments) to reduce supply-chain risk from mutable tags/branches, and updates the repo’s CI/CD guidance to require SHA pinning.
Changes:
- Updated multiple
.github/workflows/*.ymlfiles to use full commit SHAs instead of mutable refs like@v*/@main. - Strengthened GitHub Actions guidance (instructions + agents) to require SHA pinning and explain the rationale.
- Updated workflow examples across docs/agents to reflect SHA-pinned action usage.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| instructions/github-actions-ci-cd-best-practices.instructions.md | Updates workflow examples and guidance to require SHA pinning; adds supply-chain rationale. |
| agents/github-actions-expert.agent.md | Tightens “Action Pinning” guidance to require full SHAs and updates checklist/summary text. |
| agents/se-gitops-ci-specialist.agent.md | Updates embedded workflow snippets to use SHA-pinned actions. |
| .github/workflows/validate-readme.yml | Pins checkout/setup-node/sticky-comment actions to SHAs. |
| .github/workflows/validate-agentic-workflows-pr.yml | Pins checkout/setup-cli/sticky-comment actions to SHAs. |
| .github/workflows/publish.yml | Pins checkout/setup-node to SHAs. |
| .github/workflows/deploy-website.yml | Pins checkout/setup-node/pages actions to SHAs. |
| .github/workflows/copilot-setup-steps.yml | Pins checkout to a SHA. |
| .github/workflows/contributors.yml | Pins checkout/setup-node/create-pull-request to SHAs. |
| .github/workflows/codespell.yml | Pins checkout/codespell action to SHAs. |
| .github/workflows/check-pr-target.yml | Pins github-script to a SHA. |
| .github/workflows/check-plugin-structure.yml | Pins checkout/github-script to SHAs. |
| .github/workflows/check-line-endings.yml | Pins checkout to a SHA. |
|
The 1P actions |
|
Hi @aaronpowell & @brunoborges, could you please kick off the PR target branch check again? I changed it from |
|
Since you branched from the You can attempt to fix this with a rebase: If that does not resolve it, you can run |
|
Hi @aaronpowell & @brunoborges, I fixed this up. Fortunately, a squash-merge makes my initial mistakes go away. =) |
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.Description
Mutable tag references (
@v4,@main,@latest) in GitHub Actions are a supply chain attack vector — a tag can be silently moved to a malicious commit by anyone with write access to the action's repo. Replaces all such references with full commit SHAs plus human-readable version comments across workflow files and documentation.Fixes #909
Before:
After:
Workflow files (
.github/workflows/)actions/checkout,actions/setup-node,actions/github-script,actions/configure-pages,actions/upload-pages-artifact,actions/deploy-pages,marocchino/sticky-pull-request-comment,peter-evans/create-pull-request,codespell-project/actions-codespell,github/gh-aw/actions/setup-cliDocumentation & instructions
instructions/github-actions-ci-cd-best-practices.instructions.md: Strengthened guidance to require SHA pinning (not just recommend it), added supply chain attack rationale, updated all code examples with real SHAsagents/github-actions-expert.agent.md: Changed Action Pinning recommendation from "use@v4for balance" to requiring full SHA; updated checklist and best practices summaryagents/se-gitops-ci-specialist.agent.md: Updated all inline workflow examples to use SHA-pinned referencesType of Contribution
Additional Notes
Auto-generated
.lock.ymlfiles were intentionally excluded — those are machine-managed and not subject to manual pinning.By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.