[release/v7.4.15] [StepSecurity] ci: Harden GitHub Actions tags by daxian-dbw · Pull Request #27244 · PowerShell/PowerShell · GitHub
Skip to content

[release/v7.4.15] [StepSecurity] ci: Harden GitHub Actions tags#27244

Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.4.15from
daxian-dbw:backport/release/v7.4.15/27201-34375e905
Apr 9, 2026
Merged

[release/v7.4.15] [StepSecurity] ci: Harden GitHub Actions tags#27244
daxian-dbw merged 1 commit intoPowerShell:release/v7.4.15from
daxian-dbw:backport/release/v7.4.15/27201-34375e905

Conversation

@daxian-dbw
Copy link
Copy Markdown
Member

Backport of #27201 to release/v7.4.15

Triggered by @daxian-dbw on behalf of @step-security-bot

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Hardens GitHub Actions usage on release/v7.4.15 by replacing mutable action tag references with pinned commit SHAs. The backport preserves the release-branch workflow structure and carries over only the SHA pinning updates from the original PR.

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Verified by completing the cherry-pick on release/v7.4.15, reviewing the staged diff to confirm the backport only changes action references from version tags to pinned SHAs, and confirming the worktree is clean after cherry-pick completion. No local workflow execution was run; CI will validate behavior on the backport PR.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

This touches CI/build workflow infrastructure across multiple reusable workflows and action definitions. The risk is mitigated because the backport is narrowly scoped to immutable action pin updates only, with release-branch-specific runner and workflow structure intentionally preserved.

Merge Conflicts

Conflicts occurred in .github/workflows/labels.yml, .github/workflows/linux-ci.yml, .github/workflows/macos-ci.yml, .github/workflows/verify-markdown-links.yml, .github/workflows/windows-ci.yml, .github/workflows/windows-packaging-reusable.yml, and .github/workflows/xunit-tests.yml. Resolution preserved the release/v7.4.15 workflow content and applied only the original PR's @v... to @ action reference changes. Higher-version main-branch workflow differences such as runner upgrades were not brought into the backport.

Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
@daxian-dbw daxian-dbw added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Apr 9, 2026
@daxian-dbw daxian-dbw requested a review from a team as a code owner April 9, 2026 21:49
Copilot AI review requested due to automatic review settings April 9, 2026 21:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backport to release/v7.4.15 that hardens GitHub Actions usage by replacing mutable uses: <action>@v... references with pinned commit SHAs across CI workflows and composite actions.

Changes:

  • Pin actions/checkout, actions/setup-dotnet, actions/upload-artifact, actions/download-artifact, and actions/github-script references to full commit SHAs (with inline version comments).
  • Update multiple platform CI workflows (Linux/macOS/Windows) and reusable workflows (xUnit, packaging) to use the pinned references.
  • Update composite actions under .github/actions/** to use pinned action SHAs.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
.github/workflows/xunit-tests.yml Pins checkout/setup-dotnet/upload-artifact used by the reusable xUnit workflow.
.github/workflows/windows-packaging-reusable.yml Pins checkout/setup-dotnet/upload-artifact used by the reusable Windows packaging workflow.
.github/workflows/windows-ci.yml Pins checkout in Windows CI jobs.
.github/workflows/verify-markdown-links.yml Pins checkout for the markdown link verification workflow.
.github/workflows/macos-ci.yml Pins checkout/setup-dotnet/upload-artifact; minor formatting adjustment in ready_to_merge inputs.
.github/workflows/linux-ci.yml Pins checkout across Linux CI jobs.
.github/workflows/labels.yml Pins checkout and github-script used for PR label verification.
.github/workflows/copilot-setup-steps.yml Pins checkout for Copilot setup steps workflow.
.github/workflows/analyze-reusable.yml Pins setup-dotnet for reusable CodeQL workflow.
.github/actions/test/windows/action.yml Pins download-artifact and setup-dotnet used by Windows test composite action.
.github/actions/test/process-pester-results/action.yml Pins upload-artifact used to publish Pester test results.
.github/actions/test/nix/action.yml Pins download-artifact/setup-dotnet/github-script used by non-Windows test composite action.
.github/actions/test/linux-packaging/action.yml Pins setup-dotnet and upload-artifact used by Linux packaging composite action.
.github/actions/infrastructure/path-filters/action.yml Pins github-script used by path filter composite action.
.github/actions/infrastructure/get-changed-files/action.yml Pins github-script used to collect changed files.
.github/actions/build/ci/action.yml Pins setup-dotnet and upload-artifact used by CI build composite action.

Comment on lines 25 to 32
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1000

- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This change is described as a tag->SHA hardening backport, but it also upgrades action major versions (e.g., actions/checkout and actions/setup-dotnet are now pinned to v6.x/v5.x). If the intent is only to pin the previously-used versions, pin the commit for the existing tags (e.g. v4 for checkout, v4 for setup-dotnet) to avoid behavior changes on the release branch; otherwise please update the PR description/risk/testing notes to reflect the action version upgrades.

Copilot uses AI. Check for mistakes.
Comment on lines 41 to 68
@@ -64,7 +64,7 @@ jobs:
shell: pwsh

- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This workflow is claimed to only harden tags, but actions/checkout and actions/setup-dotnet are being upgraded to newer major versions (v6.x / v5.x) as part of the pinning. For a release-branch backport, consider pinning SHAs that correspond to the existing major versions (checkout v5, setup-dotnet v4) unless the major upgrade is intentional and explicitly called out/tested.

Copilot uses AI. Check for mistakes.
Comment on lines 60 to 62
- name: checkout
uses: actions/checkout@v4.1.0
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The PR description says this backport only replaces mutable tags with pinned SHAs, but this workflow effectively upgrades actions/checkout (from v4.1.0 to v6.x per the inline version comment). If the upgrade is intentional, please document it and ensure CI coverage; otherwise pin the SHA for the existing v4.1.0 (or v4) checkout version to keep behavior unchanged on the release branch.

Copilot uses AI. Check for mistakes.
Comment on lines 24 to +25
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This change upgrades actions/checkout from @v4 to a SHA annotated as # v6.0.2, which is more than tag hardening and could introduce behavioral changes. Consider pinning the SHA for the existing v4 release (or update the PR description/testing notes to explicitly include the major upgrade).

Copilot uses AI. Check for mistakes.
Comment on lines 56 to 59
steps:
- name: checkout
uses: actions/checkout@v4.1.0
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This workflow is described as a tag->SHA hardening backport, but it also upgrades actions/checkout to v6.x (per the inline comment). For release/v7.4.15, consider pinning the SHA for the previously used checkout major version unless the upgrade is intentional and explicitly called out/tested.

Copilot uses AI. Check for mistakes.
Comment on lines 163 to 169
- name: checkout
uses: actions/checkout@v5
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1000
- uses: actions/setup-dotnet@v4
- uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
global-json-file: ./global.json
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

In the packaging job, actions/setup-dotnet is being upgraded (previously @v4, now pinned as # v5.2.0). If this backport is intended to only pin existing versions, pin a commit corresponding to the existing v4 tag; otherwise please call out the major upgrade and ensure it’s covered by CI for this release branch.

Copilot uses AI. Check for mistakes.
@@ -240,4 +240,4 @@ jobs:
if: always()
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@v1.0.0
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This PR aims to harden action references by pinning to immutable SHAs, but ready_to_merge still references PowerShell/compliance by a mutable tag (@v1.0.0). To fully harden dependencies, pin this reusable workflow to a full commit SHA as well (and keep the # v1.0.0 comment if desired).

Suggested change
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@v1.0.0
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@<FULL_40_CHARACTER_COMMIT_SHA> # v1.0.0

Copilot uses AI. Check for mistakes.
Comment on lines 56 to 60
steps:
- name: checkout
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This workflow is claimed to only harden tags, but it upgrades actions/checkout across multiple jobs (previously a mix of v4/v5 tags, now pinned as # v6.0.2). For a release-branch backport, consider pinning SHAs that correspond to the existing major versions unless the upgrade is intentional and explicitly documented/tested.

Copilot uses AI. Check for mistakes.
Comment on lines 20 to +25
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This workflow update goes beyond tag hardening: actions/checkout moves from @v2 to a SHA annotated as # v6.0.2, and actions/github-script moves from @v6 to # v8.0.0. If these major upgrades are intentional, please update the backport description/testing notes accordingly; otherwise pin SHAs corresponding to the previously used major versions to minimize behavior change on the release branch.

Copilot uses AI. Check for mistakes.
@daxian-dbw daxian-dbw merged commit 623c88f into PowerShell:release/v7.4.15 Apr 9, 2026
44 checks passed
@daxian-dbw daxian-dbw deleted the backport/release/v7.4.15/27201-34375e905 branch April 9, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants