Skip to content

Commit 354e913

Browse files
Pin GitHub Actions to full-length commit SHAs (#1630)
## 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](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions). This change mitigates the risk of tag retargeting to malicious code as seen in incidents like the [tj-actions/changed-files action compromise](https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised) or [codfish/semantic-release-action compromise](https://www.stepsecurity.io/blog/supply-chain-compromise-codfish-semantic-release-action) 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](https://github.com/suzuki-shunsuke/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`). --- <sub>For more information, visit https://aka.ms/action-pinning</sub>
1 parent b192cdf commit 354e913

10 files changed

Lines changed: 73 additions & 62 deletions

.github/actions/build-vsix/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ runs:
1010
using: 'composite'
1111
steps:
1212
- name: Install Node
13-
uses: actions/setup-node@v4
13+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1414
with:
1515
node-version: ${{ inputs.node_version }}
1616
cache: 'npm'
@@ -24,7 +24,7 @@ runs:
2424
shell: bash
2525

2626
- name: Upload VSIX
27-
uses: actions/upload-artifact@v4
27+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2828
with:
2929
name: vsix
3030
path: ms-python-envs-insiders.vsix

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
groups:
6+
github-actions:
7+
patterns: ["*"]
8+
schedule:
9+
interval: "weekly"
10+
cooldown:
11+
default-days: 7

.github/workflows/code-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1717
with:
1818
fetch-depth: 0 # Full history for git analysis
1919

2020
- name: Install Python
21-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2222
with:
2323
python-version: '3.12'
2424

2525
- name: Install uv
26-
uses: astral-sh/setup-uv@v4
26+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
2727

2828
- name: Install analysis dependencies
2929
working-directory: analysis
@@ -35,7 +35,7 @@ jobs:
3535
python -m analysis.snapshot --output analysis-snapshot.json
3636
3737
- name: Upload snapshot artifact
38-
uses: actions/upload-artifact@v4
38+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3939
with:
4040
name: code-health-snapshot-${{ github.sha }}
4141
path: analysis-snapshot.json

.github/workflows/community-feedback-closer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Close community feedback issues lacking upvotes
16-
uses: actions/github-script@v7
16+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
1717
with:
1818
script: |
1919
const label = 'needs community feedback';

.github/workflows/info-needed-closer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout Actions
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1818
with:
1919
repository: 'microsoft/vscode-github-triage-actions'
2020
path: ./actions

.github/workflows/issue-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout Actions
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2020
with:
2121
repository: 'microsoft/vscode-github-triage-actions'
2222
ref: stable

.github/workflows/pr-check.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2121

2222
- name: Build VSIX
2323
uses: ./.github/actions/build-vsix
@@ -30,10 +30,10 @@ jobs:
3030

3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v4
33+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3434

3535
- name: Install Node
36-
uses: actions/setup-node@v4
36+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
3737
with:
3838
node-version: ${{ env.NODE_VERSION }}
3939
cache: 'npm'
@@ -54,10 +54,10 @@ jobs:
5454

5555
steps:
5656
- name: Checkout
57-
uses: actions/checkout@v4
57+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5858

5959
- name: Install Node
60-
uses: actions/setup-node@v4
60+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
6161
with:
6262
node-version: ${{ env.NODE_VERSION }}
6363
cache: 'npm'
@@ -86,10 +86,10 @@ jobs:
8686

8787
steps:
8888
- name: Checkout
89-
uses: actions/checkout@v4
89+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
9090

9191
- name: Checkout Python Environment Tools
92-
uses: actions/checkout@v4
92+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
9393
with:
9494
repository: 'microsoft/python-environment-tools'
9595
path: 'python-env-tools-src'
@@ -103,7 +103,7 @@ jobs:
103103
uses: dtolnay/rust-toolchain@stable
104104

105105
- name: Cache Rust build
106-
uses: actions/cache@v4
106+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
107107
with:
108108
path: |
109109
~/.cargo/registry
@@ -132,13 +132,13 @@ jobs:
132132
shell: bash
133133

134134
- name: Install Node
135-
uses: actions/setup-node@v4
135+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
136136
with:
137137
node-version: ${{ env.NODE_VERSION }}
138138
cache: 'npm'
139139

140140
- name: Install Python
141-
uses: actions/setup-python@v5
141+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
142142
with:
143143
python-version: ${{ matrix.python-version }}
144144

@@ -153,7 +153,7 @@ jobs:
153153

154154
- name: Run Smoke Tests (Linux)
155155
if: runner.os == 'Linux'
156-
uses: GabrielBB/xvfb-action@v1
156+
uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d # v1.6
157157
with:
158158
run: npm run smoke-test
159159

@@ -173,10 +173,10 @@ jobs:
173173

174174
steps:
175175
- name: Checkout
176-
uses: actions/checkout@v4
176+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
177177

178178
- name: Checkout Python Environment Tools
179-
uses: actions/checkout@v4
179+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
180180
with:
181181
repository: 'microsoft/python-environment-tools'
182182
path: 'python-env-tools-src'
@@ -190,7 +190,7 @@ jobs:
190190
uses: dtolnay/rust-toolchain@stable
191191

192192
- name: Cache Rust build
193-
uses: actions/cache@v4
193+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
194194
with:
195195
path: |
196196
~/.cargo/registry
@@ -219,13 +219,13 @@ jobs:
219219
shell: bash
220220

221221
- name: Install Node
222-
uses: actions/setup-node@v4
222+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
223223
with:
224224
node-version: ${{ env.NODE_VERSION }}
225225
cache: 'npm'
226226

227227
- name: Install Python
228-
uses: actions/setup-python@v5
228+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
229229
with:
230230
python-version: ${{ matrix.python-version }}
231231

@@ -240,7 +240,7 @@ jobs:
240240

241241
- name: Run E2E Tests (Linux)
242242
if: runner.os == 'Linux'
243-
uses: GabrielBB/xvfb-action@v1
243+
uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d # v1.6
244244
with:
245245
run: npm run e2e-test
246246

@@ -260,10 +260,10 @@ jobs:
260260

261261
steps:
262262
- name: Checkout
263-
uses: actions/checkout@v4
263+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
264264

265265
- name: Checkout Python Environment Tools
266-
uses: actions/checkout@v4
266+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
267267
with:
268268
repository: 'microsoft/python-environment-tools'
269269
path: 'python-env-tools-src'
@@ -277,7 +277,7 @@ jobs:
277277
uses: dtolnay/rust-toolchain@stable
278278

279279
- name: Cache Rust build
280-
uses: actions/cache@v4
280+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
281281
with:
282282
path: |
283283
~/.cargo/registry
@@ -306,13 +306,13 @@ jobs:
306306
shell: bash
307307

308308
- name: Install Node
309-
uses: actions/setup-node@v4
309+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
310310
with:
311311
node-version: ${{ env.NODE_VERSION }}
312312
cache: 'npm'
313313

314314
- name: Install Python
315-
uses: actions/setup-python@v5
315+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
316316
with:
317317
python-version: ${{ matrix.python-version }}
318318

@@ -327,7 +327,7 @@ jobs:
327327

328328
- name: Run Integration Tests (Linux)
329329
if: runner.os == 'Linux'
330-
uses: GabrielBB/xvfb-action@v1
330+
uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d # v1.6
331331
with:
332332
run: npm run integration-test
333333

@@ -347,16 +347,16 @@ jobs:
347347

348348
steps:
349349
- name: Checkout
350-
uses: actions/checkout@v4
350+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
351351

352352
- name: Install Node
353-
uses: actions/setup-node@v4
353+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
354354
with:
355355
node-version: ${{ env.NODE_VERSION }}
356356
cache: 'npm'
357357

358358
- name: Install Python
359-
uses: actions/setup-python@v5
359+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
360360
with:
361361
python-version: ${{ matrix.python-version }}
362362

@@ -371,7 +371,7 @@ jobs:
371371

372372
- name: Run Integration Tests Multi-Root (Linux)
373373
if: runner.os == 'Linux'
374-
uses: GabrielBB/xvfb-action@v1
374+
uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d # v1.6
375375
with:
376376
run: npm run integration-test-multiroot
377377

0 commit comments

Comments
 (0)