Skip to content

Pin GitHub Actions to full-length commit SHAs - #537

Open
Microsoft Open Source Security Bot (OssSecurityBot) wants to merge 1 commit into
microsoft:mainfrom
OssSecurityBot:oss-security-bot/pin-actions
Open

Pin GitHub Actions to full-length commit SHAs#537
Microsoft Open Source Security Bot (OssSecurityBot) wants to merge 1 commit into
microsoft:mainfrom
OssSecurityBot:oss-security-bot/pin-actions

Conversation

@OssSecurityBot

Summary

This PR pins GitHub Actions to full-length commit SHAs for improved security and reproducibility and adds a 7 day cooldown to Dependabot configuration for GitHub Actions.

Why?

Pinning actions to commit SHAs prevents supply-chain attacks where a tag could be moved to point to malicious code. This is a recommended security best practice per the GitHub Actions security hardening guide.

This change mitigates the risk of tag retargeting to malicious code as seen in incidents like the tj-actions/changed-files action compromise or codfish/semantic-release-action compromise and improves the integrity and reproducibility of the CI/CD pipeline.

What changed?

Action pinning: Third-party action references in .github/workflows/ that used mutable tag-based references (e.g., actions/checkout@v4) have been updated to full-length commit SHAs with a version comment (e.g., actions/checkout@<sha> # v4) using the pinact tool. References that were already pinned to a SHA, or that used immutable release tags, were left unchanged.

Dependabot configuration: .github/dependabot.yml has been updated to ensure a github-actions package-ecosystem section is present with a cooldown configuration (default-days: 7). This groups Dependabot PRs for GitHub Actions and enforces a minimum 7-day cooldown between updates. If the file did not exist, it was created. If a github-actions section already existed, only the cooldown block was added or its default-days value was increased to 7 if it was lower. The 7-day cooldown provides a window for the community to detect and report compromised releases before they are automatically proposed as updates, reducing exposure to supply-chain attacks via newly published malicious versions.

Is this safe to merge?

Yes. The pinned SHAs correspond to the same commits that the existing tags pointed to. No behavioral changes are introduced. You can verify the pinned SHA value using the GitHub REST API (e.g., the commit hash for actions/checkout@v7 can be found in the sha property in the JSON response for GET https://api.github.com/repos/actions/checkout/commits/v7).


For more information, visit https://aka.ms/action-pinning

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the repository’s CI/CD supply chain by replacing mutable tag-based GitHub Action references with full-length commit SHAs across workflows, and adds a Dependabot configuration to manage GitHub Actions updates with a 7-day cooldown.

Changes:

  • Pin third-party GitHub Actions in .github/workflows/*.yml to full-length commit SHAs (with version comments).
  • Add .github/dependabot.yml to enable grouped GitHub Actions updates with a weekly schedule and 7-day cooldown.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/tests.yml Pins actions used by the main test/lint workflow to SHAs.
.github/workflows/tests-full.yml Pins actions used by extended test matrix workflows to SHAs.
.github/workflows/pypi-release.yml Pins actions used in PyPI release pipeline to SHAs.
.github/workflows/pypi-nightly.yml Pins actions used in nightly PyPI publish workflow to SHAs.
.github/workflows/playground.yml Pins checkout action for the playground workflow.
.github/workflows/issue-comment.yml Pins actions/github-script to a SHA for issue-comment automation.
.github/workflows/examples-unsloth.yml Pins actions used by the unsloth example workflow to SHAs.
.github/workflows/examples-tinker.yml Pins actions used by the tinker example workflow to SHAs.
.github/workflows/examples-spider.yml Pins actions used by the spider example workflow to SHAs.
.github/workflows/examples-rag.yml Pins actions used by the rag example workflow to SHAs.
.github/workflows/examples-compat.yml Pins actions used by the compatibility example workflow to SHAs.
.github/workflows/examples-claude-code.yml Pins actions used by the claude-code example workflow to SHAs.
.github/workflows/examples-chartqa.yml Pins actions used by the chartqa example workflow to SHAs.
.github/workflows/examples-calc-x.yml Pins actions used by the calc-x example workflow to SHAs.
.github/workflows/examples-azure.yml Pins actions used by the azure example workflow to SHAs.
.github/workflows/examples-apo.yml Pins actions used by the apo example workflow to SHAs.
.github/workflows/docs.yml Pins actions used by the docs build/deploy workflow to SHAs.
.github/workflows/dashboard.yml Pins actions used by the dashboard/Chromatic workflow to SHAs.
.github/workflows/benchmark.yml Pins actions used by benchmark workflows (including artifact upload) to SHAs.
.github/workflows/badge-unsloth.yml Pins actions used to update the unsloth badge workflow to SHAs.
.github/workflows/badge-unit.yml Pins actions used to update the unit badge workflow to SHAs.
.github/workflows/badge-tinker.yml Pins actions used to update the tinker badge workflow to SHAs.
.github/workflows/badge-spider.yml Pins actions used to update the spider badge workflow to SHAs.
.github/workflows/badge-rag.yml Pins actions used to update the rag badge workflow to SHAs.
.github/workflows/badge-latest.yml Pins actions used to update the latest badge workflow to SHAs.
.github/workflows/badge-examples.yml Pins actions used to update the examples badge workflow to SHAs.
.github/workflows/badge-compat.yml Pins actions used to update the compat badge workflow to SHAs.
.github/workflows/badge-claude-code.yml Pins actions used to update the claude-code badge workflow to SHAs.
.github/workflows/badge-chartqa.yml Pins actions used to update the chartqa badge workflow to SHAs.
.github/workflows/badge-calc-x.yml Pins actions used to update the calc-x badge workflow to SHAs.
.github/workflows/badge-azure.yml Pins actions used to update the azure badge workflow to SHAs.
.github/workflows/badge-apo.yml Pins actions used to update the apo badge workflow to SHAs.
.github/workflows/backport.yml Pins actions used by the backport automation workflow to SHAs.
.github/dependabot.yml Adds Dependabot config for grouped GitHub Actions updates with weekly schedule and 7-day cooldown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +29
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
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.

2 participants