Pin GitHub Actions to full-length commit SHAs - #15013
Pin GitHub Actions to full-length commit SHAs#15013Dan Fiedler (danfiedler-msft) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Pins third-party GitHub Actions to full commit SHAs to improve supply-chain security and build reproducibility, and adds a Dependabot configuration to slow GitHub Actions updates.
Changes:
- Replaced tag-based
uses:references in workflows with full-length commit SHAs and version comments. - Added/updated version comments for some already-SHA-pinned actions.
- Added
.github/dependabot.ymlwithgithub-actionsupdates and a 7-day cooldown.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/yaml-syntax-validation.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/workbook-template-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/workbook-metadata-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/validateVersionChangedInDetections.yml | Pin actions/checkout to a full SHA (still on v1). |
| .github/workflows/validateFieldTypes.yaml | Add version comments to already-SHA-pinned actions. |
| .github/workflows/validateClassicAppInsights.yaml | Add version comments to already-SHA-pinned actions. |
| .github/workflows/solutionIntegration.yaml | Pin multiple actions to SHAs (checkout/login/setup-python). |
| .github/workflows/solution-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/slash-command-armttk.yaml | Pin actions/github-script to a full SHA. |
| .github/workflows/sample-data-validation.yaml | Pin checkout and setup-node to SHAs. |
| .github/workflows/runAsimSchemaAndDataTesters.yaml | Pin github-script, checkout, setup-python, azure/* to SHAs. |
| .github/workflows/playbook-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/non-ascii-validations.yaml | Pin checkout and setup-dotnet to SHAs. |
| .github/workflows/neworexistingsolution.yaml | Add version comment to already-SHA-pinned checkout. |
| .github/workflows/logo-validation.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/kql-validations.yaml | Pin checkout and setup-dotnet to SHAs. |
| .github/workflows/json-syntax-validation.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/hyperlinkValidator.yaml | Add version comments to already-SHA-pinned actions. |
| .github/workflows/getSolutionName.yaml | Add version comment to already-SHA-pinned checkout. |
| .github/workflows/documents-link-validation.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/detection-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/detection-template-schema-validations.yaml | Pin checkout and setup-dotnet to SHAs. |
| .github/workflows/data-connector-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/convertKqlFunctionYamlToArmTemplate.yaml | Pin several actions to SHAs and add version comments. |
| .github/workflows/content-validations.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/codeql-analysis.yml | Pin checkout, codeql-action, setup-dotnet to SHAs. |
| .github/workflows/cleanup-stale-branch.yaml | Add version comment to already-SHA-pinned action. |
| .github/workflows/checkSkipPackagingInfo.yaml | Add version comment to already-SHA-pinned checkout. |
| .github/workflows/checkPRContentChange.yaml | Add version comment to already-SHA-pinned checkout. |
| .github/workflows/aws-s3-bundle-update.yaml | Pin create-github-app-token and checkout to SHAs. |
| .github/workflows/addLabelOnPr.yaml | Add version comment to already-SHA-pinned action. |
| .github/workflows/addComment.yaml | Add version comment to already-SHA-pinned action. |
| .github/workflows/ScanSecrets.yaml | Pin actions/checkout to a full SHA. |
| .github/workflows/IssueComment.yml | Add version comment to already-SHA-pinned action. |
| .github/workflows/AddLabel.yaml | Add version comment to already-SHA-pinned action. |
| .github/dependabot.yml | Add Dependabot config for GitHub Actions with grouping and 7-day cooldown. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0 |
| steps: | ||
| - name: Checkout pull request branch | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0 |
| steps: | ||
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
| - uses: actions/checkout@v1 | ||
| - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1.2.0 |
|
|
||
| - name: Setup Python Environment | ||
| uses: actions/setup-python@v2 | ||
| uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2.3.4 |
| - name: Generate a token | ||
| id: generate_token | ||
| uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9 | ||
| uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9 # v1.6.1 |
| private-key: ${{ env.GITHUB_APPS_KEY }} | ||
|
|
||
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
|
Hi Dan Fiedler (@danfiedler-msft), |
|
Hi Dan Fiedler (@danfiedler-msft), |
|
Hi Dan Fiedler (@danfiedler-msft), |
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. This work is described in more detail at https://aka.ms/action-pinning.
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.ymlhas been updated to ensure agithub-actionspackage-ecosystem section is present with acooldownconfiguration (default-days: 7). If the file did not exist, it was created. If agithub-actionssection already existed, only thecooldownblock was added or itsdefault-daysvalue 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 in action execution are introduced. You can verify the pinned SHA value using the GitHub REST API (e.g., the commit hash for
actions/checkout@v7can be found in theshaproperty in the JSON response forGET https://api.github.com/repos/actions/checkout/commits/v7).Additional Information
For more information, please see https://aka.ms/action-pinning