Skip to content

Commit 16cf228

Browse files
Pin GitHub Actions to full-length commit SHAs (#1717)
## 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
1 parent 7e0457a commit 16cf228

3 files changed

Lines changed: 30 additions & 19 deletions

File tree

.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/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
1414
- name: Use Node.js 20
15-
uses: actions/setup-node@v5
15+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
1616
with:
1717
node-version: '20'
1818
cache: 'npm'
@@ -28,9 +28,9 @@ jobs:
2828
os: [ubuntu-latest, macos-15, windows-latest]
2929
runs-on: ${{ matrix.os }}
3030
steps:
31-
- uses: actions/checkout@v5
31+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
3232
- name: Use Node.js 20
33-
uses: actions/setup-node@v5
33+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
3434
with:
3535
node-version: '20'
3636
cache: 'npm'
@@ -46,9 +46,9 @@ jobs:
4646
test_mcp_docker:
4747
runs-on: ubuntu-latest
4848
steps:
49-
- uses: actions/checkout@v5
49+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
5050
- name: Use Node.js 20
51-
uses: actions/setup-node@v5
51+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
5252
with:
5353
node-version: '20'
5454
cache: 'npm'
@@ -57,9 +57,9 @@ jobs:
5757
- name: Playwright install
5858
run: npx playwright install --with-deps chromium
5959
- name: Set up Docker Buildx
60-
uses: docker/setup-buildx-action@v4
60+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
6161
- name: Build and push
62-
uses: docker/build-push-action@v7
62+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
6363
with:
6464
tags: playwright-mcp-dev:latest
6565
cache-from: type=gha

.github/workflows/publish.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
contents: read
1515
id-token: write # Required for OIDC npm publishing
1616
steps:
17-
- uses: actions/checkout@v5
18-
- uses: actions/setup-node@v5
17+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
18+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
1919
with:
2020
node-version: 24
2121
registry-url: https://registry.npmjs.org/
@@ -50,8 +50,8 @@ jobs:
5050
contents: read
5151
id-token: write # Required for OIDC npm publishing
5252
steps:
53-
- uses: actions/checkout@v5
54-
- uses: actions/setup-node@v5
53+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
54+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
5555
with:
5656
node-version: 24
5757
registry-url: https://registry.npmjs.org/
@@ -76,7 +76,7 @@ jobs:
7676
contents: read
7777
id-token: write # Required for GitHub OIDC auth to the MCP Registry
7878
steps:
79-
- uses: actions/checkout@v5
79+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
8080

8181
- name: Validate server.json version matches package.json
8282
run: |
@@ -116,13 +116,13 @@ jobs:
116116
id-token: write # Needed for OIDC login to Azure
117117
environment: allow-publishing-docker-to-acr
118118
steps:
119-
- uses: actions/checkout@v5
119+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
120120
- name: Set up QEMU # Needed for multi-platform builds (e.g., arm64 on amd64 runner)
121-
uses: docker/setup-qemu-action@v4
121+
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
122122
- name: Set up Docker Buildx # Needed for multi-platform builds
123-
uses: docker/setup-buildx-action@v4
123+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
124124
- name: Azure Login via OIDC
125-
uses: azure/login@v3
125+
uses: azure/login@f5d393ae46f8fde4be8b75f32e3fc50e654ad0ca # v3.0.1
126126
with:
127127
client-id: ${{ secrets.AZURE_DOCKER_CLIENT_ID }}
128128
tenant-id: ${{ secrets.AZURE_DOCKER_TENANT_ID }}
@@ -131,15 +131,15 @@ jobs:
131131
run: az acr login --name playwright
132132
- name: Build and push Docker image
133133
id: build-push
134-
uses: docker/build-push-action@v7
134+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
135135
with:
136136
file: ./Dockerfile
137137
platforms: linux/amd64,linux/arm64
138138
push: true
139139
tags: |
140140
playwright.azurecr.io/public/playwright/mcp:${{ github.event.release.tag_name }}
141141
playwright.azurecr.io/public/playwright/mcp:latest
142-
- uses: oras-project/setup-oras@v2
142+
- uses: oras-project/setup-oras@1d808f7d7f6995cc68b7bf507bfe5c5446e1dc9d # v2.0.1
143143
- name: Set oras tags
144144
run: |
145145
attach_eol_manifest() {

0 commit comments

Comments
 (0)