Skip to content

Commit cf4115b

Browse files
authored
ci: hardening security of Github actions (#69)
## Proposed changes This pull request enhances the security of our GitHub Actions workflows by implementing several best practices: - Pinning Actions to Commit SHAs: All external GitHub Actions are now pinned to specific commit SHAs instead of floating versions (e.g., @v4). This prevents unexpected or malicious code from being executed if a version tag is updated. - Updated Actions: All actions have been updated to their latest stable versions to include the latest features and security fixes. - Workflow Cleanup: Minor linter issues have been resolved. ## Types of changes [//]: # 'What types of changes does your code introduce to WebdriverIO?' [//]: # '_Put an `x` in the boxes that apply_' - [ ] Polish (an improvement for an existing feature) - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improvements to the project's docs) - [X] Internal updates (everything related to internal scripts, governance documentation and CI files) ## Checklist [//]: # "_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._" - [X] I have read the [CONTRIBUTING](https://github.com/webdriverio/vscode-webdriverio/blob/main/CONTRIBUTING.md) doc - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation (if appropriate) - [ ] I have added proper type definitions for new commands (if appropriate) ## Further comments [//]: # 'If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...' ### Reviewers: @webdriverio/project-committers
1 parent 68df660 commit cf4115b

17 files changed

Lines changed: 47 additions & 62 deletions

File tree

.github/workflows/actions/cache-vscode/action.yml renamed to .github/actions/cache-vscode/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313

1414
- name: 🗃️ Use cached vscode
1515
if: ${{ steps.generate-key.outputs.vscode-cache-key != '' }}
16-
uses: actions/[email protected]
16+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
1717
with:
1818
path: ${{ inputs.path }}
1919
key: ${{ steps.generate-key.outputs.vscode-cache-key }}

.github/workflows/actions/download-archive/action.yml renamed to .github/actions/download-archive/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
using: 'composite'
1212
steps:
1313
- name: ⬇️ Download Build Archive
14-
uses: actions/[email protected]
14+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
1515
with:
1616
name: ${{ inputs.name }}
1717
path: ${{ inputs.path }}

.github/workflows/actions/set-screen-resolution/action.yml renamed to .github/actions/set-screen-resolution/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@ runs:
3737
if: runner.os == 'macOS'
3838
shell: bash
3939
run: |
40+
echo "::group::brew install displayplacer"
4041
brew install displayplacer
42+
echo "::endgroup::"
4143
displayplacer list

.github/workflows/actions/setup-workspace/action.yml renamed to .github/actions/setup-workspace/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ runs:
99
using: composite
1010
steps:
1111
- name: 🧰 Setup PNPM
12-
uses: pnpm/[email protected]
12+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
1313
with:
1414
run_install: false
1515

1616
- name: 🛠️ Setup Node.js ${{ inputs.node-version }}
17-
uses: actions/[email protected]
17+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1818
with:
1919
node-version: ${{ inputs.node-version }}
2020
cache: 'pnpm'

.github/workflows/actions/upload-archive/action.yml renamed to .github/actions/upload-archive/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runs:
2121
if: ${{ runner.os == 'Windows' }}
2222

2323
- name: ⬆️ Upload Archive
24-
uses: actions/[email protected]
24+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2525
with:
2626
name: ${{ inputs.name }}
2727
path: ${{ inputs.output }}

.github/workflows/ci-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
runs-on: ${{ inputs.os }}
2020
steps:
2121
- name: 👷 Checkout
22-
uses: actions/[email protected]
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323
with:
2424
ssh-key: ${{ secrets.DEPLOY_KEY }}
2525

2626
- name: 🛠️ Setup workspace
27-
uses: ./.github/workflows/actions/setup-workspace
27+
uses: ./.github/actions/setup-workspace
2828
with:
2929
node-version: '20'
3030

@@ -34,7 +34,7 @@ jobs:
3434

3535
- name: ⬆️ Upload Build Artifacts
3636
if: ${{ runner.os == 'Linux' }}
37-
uses: ./.github/workflows/actions/upload-archive
37+
uses: ./.github/actions/upload-archive
3838
with:
3939
name: vscode-webdriverio
4040
output: vscode-webdriverio-build.zip

.github/workflows/ci-e2e.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,46 @@ jobs:
2626
runs-on: ${{ matrix.os }}
2727
steps:
2828
- name: 👷 Checkout
29-
uses: actions/[email protected]
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030
with:
3131
ssh-key: ${{ secrets.DEPLOY_KEY }}
3232

3333
- name: 🛠️ Setup workspace
34-
uses: ./.github/workflows/actions/setup-workspace
34+
uses: ./.github/actions/setup-workspace
3535
with:
3636
node-version: ${{ matrix.node-version }}
3737

3838
- name: ⬇️ Download Build Archive
39-
uses: ./.github/workflows/actions/download-archive
39+
uses: ./.github/actions/download-archive
4040
with:
4141
name: vscode-webdriverio
4242
path: .
4343
filename: vscode-webdriverio-build.zip
4444

4545
- name: 🗃️ Use cached vscode
46-
uses: ./.github/workflows/actions/cache-vscode
46+
uses: ./.github/actions/cache-vscode
4747
with:
4848
path: e2e/.wdio-vscode-service
4949

5050
- name: 🖥️ Set screen resolution
51-
uses: ./.github/workflows/actions/set-screen-resolution
51+
uses: ./.github/actions/set-screen-resolution
5252

5353
- name: 🧪 Run the e2e test
5454
env:
5555
E2E_SCENARIO: ${{ matrix.scenario }}
56-
run: pnpm --filter @vscode-wdio/e2e run test:e2e:${E2E_SCENARIO}
56+
run: pnpm --filter @vscode-wdio/e2e run "test:e2e:${E2E_SCENARIO}"
5757
shell: bash
5858

5959
- name: 📦 Upload Test Logs on Failure
60-
uses: ./.github/workflows/actions/upload-archive
60+
uses: ./.github/actions/upload-archive
6161
if: failure()
6262
with:
6363
name: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-${{ matrix.scenario }}-logs-${{ matrix.os }}
6464
output: ${{ inputs.compatibility-mode == 'yes' && 'compatibility' || 'e2e' }}-${{ matrix.scenario }}-logs-${{ matrix.os }}.zip
6565
paths: e2e/logs
6666

6767
- name: 🐛 Debug Build
68-
uses: stateful/[email protected]
68+
uses: stateful/vscode-server-action@ec99599aefe0bf96d14491e1d5f7e80d30e22247 # v1.1.0
6969
if: failure()
7070
with:
7171
timeout: '180000'

.github/workflows/ci-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
runs-on: 'ubuntu-latest'
1515
steps:
1616
- name: 👷 Checkout
17-
uses: actions/[email protected]
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818
with:
1919
ssh-key: ${{ secrets.DEPLOY_KEY }}
2020

2121
- name: 🛠️ Setup workspace
22-
uses: ./.github/workflows/actions/setup-workspace
22+
uses: ./.github/actions/setup-workspace
2323
with:
2424
node-version: '20'
2525

.github/workflows/ci-smoke.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,46 @@ jobs:
2323
runs-on: ${{ matrix.os }}
2424
steps:
2525
- name: 👷 Checkout
26-
uses: actions/[email protected]
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
with:
2828
ssh-key: ${{ secrets.DEPLOY_KEY }}
2929

3030
- name: 🛠️ Setup workspace
31-
uses: ./.github/workflows/actions/setup-workspace
31+
uses: ./.github/actions/setup-workspace
3232
with:
3333
node-version: ${{ matrix.node-version }}
3434

3535
- name: ⬇️ Download Build Archive
36-
uses: ./.github/workflows/actions/download-archive
36+
uses: ./.github/actions/download-archive
3737
with:
3838
name: vscode-webdriverio
3939
path: .
4040
filename: vscode-webdriverio-build.zip
4141

4242
- name: 🗃️ Use cached vscode
43-
uses: ./.github/workflows/actions/cache-vscode
43+
uses: ./.github/actions/cache-vscode
4444
with:
4545
path: e2e/.wdio-vscode-service
4646

4747
- name: 🖥️ Set screen resolution
48-
uses: ./.github/workflows/actions/set-screen-resolution
48+
uses: ./.github/actions/set-screen-resolution
4949

5050
- name: 🚂 Run the smoke test
5151
env:
5252
E2E_SCENARIO: ${{ inputs.scenario }}
53-
run: pnpm --filter @vscode-wdio/e2e run test:smoke:${E2E_SCENARIO}
53+
run: pnpm --filter @vscode-wdio/e2e run "test:smoke:${E2E_SCENARIO}"
5454
shell: bash
5555

5656
- name: 📦 Upload Test Logs on Failure
57-
uses: ./.github/workflows/actions/upload-archive
57+
uses: ./.github/actions/upload-archive
5858
if: failure()
5959
with:
6060
name: smoke-${{ inputs.scenario }}--logs-${{ matrix.os }}
6161
output: smoke-${{ inputs.scenario }}-logs-${{ matrix.os }}.zip
6262
paths: e2e/logs
6363

6464
- name: 🐛 Debug Build
65-
uses: stateful/[email protected]
65+
uses: stateful/vscode-server-action@ec99599aefe0bf96d14491e1d5f7e80d30e22247 # v1.1.0
6666
if: failure()
6767
with:
6868
timeout: '180000'

.github/workflows/ci-typecheck.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ jobs:
1919
runs-on: ${{ matrix.os }}
2020
steps:
2121
- name: 👷 Checkout
22-
uses: actions/[email protected]
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323
with:
2424
ssh-key: ${{ secrets.DEPLOY_KEY }}
2525

2626
- name: 🛠️ Setup workspace
27-
uses: ./.github/workflows/actions/setup-workspace
27+
uses: ./.github/actions/setup-workspace
2828
with:
2929
node-version: ${{ matrix.node-version }}
3030

3131
- name: ⬇️ Download Build Archive
32-
uses: ./.github/workflows/actions/download-archive
32+
uses: ./.github/actions/download-archive
3333
with:
3434
name: vscode-webdriverio
3535
path: .

0 commit comments

Comments
 (0)