Skip to content

Commit ad55940

Browse files
danfiedler-msftedvilmerchiodo
authored
Pin GitHub Actions to full-length commit SHAs (#26213)
## 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](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`). 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 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@v7` can be found in the `sha` property in the JSON response for `GET https://api.github.com/repos/actions/checkout/commits/v7`). ## Additional Information For more information, please see https://aka.ms/action-pinning --------- Co-authored-by: Eduardo Villalpando Mello <eduardovil@microsoft.com> Co-authored-by: Rich Chiodo false <rchiodo@microsoft.com> Copilot-Session: ee5422c8-7d8e-4ef8-a050-de857f5b799a
1 parent d839353 commit ad55940

7 files changed

Lines changed: 32 additions & 16 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ runs:
2222
using: 'composite'
2323
steps:
2424
- name: Install Node
25-
uses: actions/setup-node@v7
25+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
2626
with:
2727
node-version: ${{ inputs.node_version }}
2828
cache: 'npm'
2929

3030
- name: Rust Tool Chain setup
31-
uses: dtolnay/rust-toolchain@stable
31+
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # stable
32+
with:
33+
toolchain: stable
3234

3335
# Jedi LS depends on dataclasses which is not in the stdlib in Python 3.7.
3436
- name: Use Python 3.10 for JediLSP
35-
uses: actions/setup-python@v7
37+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
3638
with:
3739
python-version: '3.10'
3840
cache: 'pip'

‎.github/actions/lint/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@v7
13+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
1414
with:
1515
node-version: ${{ inputs.node_version }}
1616
cache: 'npm'
@@ -36,7 +36,7 @@ runs:
3636
shell: bash
3737

3838
- name: Install Python
39-
uses: actions/setup-python@v7
39+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
4040
with:
4141
python-version: '3.x'
4242
cache: 'pip'

‎.github/actions/smoke-tests/action.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ runs:
1313
using: 'composite'
1414
steps:
1515
- name: Install Node
16-
uses: actions/setup-node@v4
16+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1717
with:
1818
node-version: ${{ inputs.node_version }}
1919
cache: 'npm'
2020

2121
- name: Install Python
22-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2323
with:
2424
python-version: '3.x'
2525
cache: 'pip'
@@ -43,7 +43,7 @@ runs:
4343

4444
# Bits from the VSIX are reused by smokeTest.ts to speed things up.
4545
- name: Download VSIX
46-
uses: actions/download-artifact@v4
46+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4747
with:
4848
name: ${{ inputs.artifact_name }}
4949

‎.github/dependabot.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,35 @@ updates:
66
interval: daily
77
labels:
88
- 'no-changelog'
9+
cooldown:
10+
default-days: 7
911

1012
- package-ecosystem: 'github-actions'
1113
directory: .github/actions/build-vsix
1214
schedule:
1315
interval: daily
1416
labels:
1517
- 'no-changelog'
18+
cooldown:
19+
default-days: 7
1620

1721
- package-ecosystem: 'github-actions'
1822
directory: .github/actions/lint
1923
schedule:
2024
interval: daily
2125
labels:
2226
- 'no-changelog'
27+
cooldown:
28+
default-days: 7
2329

2430
- package-ecosystem: 'github-actions'
2531
directory: .github/actions/smoke-test
2632
schedule:
2733
interval: daily
2834
labels:
2935
- 'no-changelog'
36+
cooldown:
37+
default-days: 7
3038

3139
# Not skipping the news for some Python dependencies in case it's actually useful to communicate to users.
3240
- package-ecosystem: 'pip'

‎.github/workflows/build.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
sparse-checkout-cone-mode: false
240240

241241
- name: Install Node
242-
uses: actions/setup-node@v7
242+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
243243
with:
244244
node-version: ${{ env.NODE_VERSION }}
245245
cache: 'npm'
@@ -273,7 +273,9 @@ jobs:
273273
run: python -m pip install --upgrade -r build/test-requirements.txt
274274

275275
- name: Rust Tool Chain setup
276-
uses: dtolnay/rust-toolchain@stable
276+
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # stable
277+
with:
278+
toolchain: stable
277279

278280
- name: Build Native Binaries
279281
run: nox --session native_build

‎.github/workflows/codeql-analysis.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v4.37.9
45+
uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -67,4 +67,4 @@ jobs:
6767
# make release
6868

6969
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v4.37.9
70+
uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9

‎.github/workflows/pr-check.yml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ jobs:
232232
sparse-checkout-cone-mode: false
233233

234234
- name: Install Node
235-
uses: actions/setup-node@v7
235+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
236236
with:
237237
node-version: ${{ env.NODE_VERSION }}
238238
cache: 'npm'
@@ -266,7 +266,9 @@ jobs:
266266
run: python -m pip install --upgrade -r build/test-requirements.txt
267267

268268
- name: Rust Tool Chain setup
269-
uses: dtolnay/rust-toolchain@stable
269+
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # stable
270+
with:
271+
toolchain: stable
270272

271273
- name: Build Native Binaries
272274
run: nox --session native_build
@@ -507,7 +509,7 @@ jobs:
507509
sparse-checkout-cone-mode: false
508510

509511
- name: Install Node
510-
uses: actions/setup-node@v7
512+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
511513
with:
512514
node-version: ${{ env.NODE_VERSION }}
513515
cache: 'npm'
@@ -548,7 +550,9 @@ jobs:
548550
shell: bash
549551

550552
- name: Rust Tool Chain setup
551-
uses: dtolnay/rust-toolchain@stable
553+
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # stable
554+
with:
555+
toolchain: stable
552556

553557
- name: Build Native Binaries
554558
run: nox --session native_build

0 commit comments

Comments
 (0)