Skip to content

Commit ef99cfd

Browse files
sserrataclaude
andauthored
ci: harden GitHub Actions workflows (#1412)
Address findings from security review: fix stale version comments on SHA-pinned actions, add frozen-lockfile and ignore-scripts to canary install, switch validate downstream jobs to read-only cache, increase Dependabot cooldown to 7 days, and add concurrency groups. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent da0dcd5 commit ef99cfd

File tree

8 files changed

+44
-36
lines changed

8 files changed

+44
-36
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ updates:
55
schedule:
66
interval: weekly
77
cooldown:
8-
default-days: 3
8+
default-days: 7
99
groups:
1010
react:
1111
patterns:
@@ -17,4 +17,4 @@ updates:
1717
schedule:
1818
interval: weekly
1919
cooldown:
20-
default-days: 3
20+
default-days: 7

.github/workflows/build-perf.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99

1010
permissions: {}
1111

12+
concurrency:
13+
group: build-perf-${{ github.event.number }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
build-size:
1418
if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' }}
@@ -19,14 +23,14 @@ jobs:
1923
contents: read
2024
pull-requests: write
2125
steps:
22-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2327
with:
2428
persist-credentials: false
2529
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
2630
with:
2731
node-version: "22"
2832
cache: yarn
29-
- uses: preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a # v2
33+
- uses: preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a # v2.8.0
3034
with:
3135
repo-token: ${{ secrets.GITHUB_TOKEN }}
3236
build-script: build
@@ -44,7 +48,7 @@ jobs:
4448
permissions:
4549
contents: read
4650
steps:
47-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
51+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4852
with:
4953
persist-credentials: false
5054
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323

2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2727
with:
2828
persist-credentials: false
2929

3030
- name: Initialize CodeQL
31-
uses: github/codeql-action/init@ebcb5b36ded6beda4ceefea6a8bc4cc885255bb3 # v3
31+
uses: github/codeql-action/init@ebcb5b36ded6beda4ceefea6a8bc4cc885255bb3 # v3.34.1
3232
with:
3333
languages: ${{ matrix.language }}
3434
queries: security-extended
3535

3636
- name: Perform CodeQL Analysis
37-
uses: github/codeql-action/analyze@ebcb5b36ded6beda4ceefea6a8bc4cc885255bb3 # v3
37+
uses: github/codeql-action/analyze@ebcb5b36ded6beda4ceefea6a8bc4cc885255bb3 # v3.34.1

.github/workflows/deploy-live.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2424
with:
2525
persist-credentials: false
2626

@@ -42,7 +42,7 @@ jobs:
4242
- name: Check for tampered config
4343
run: git diff --exit-code -- firebase.json .firebaserc package.json yarn.lock 'demo/docusaurus.config.*' 'scripts/**' '.github/**'
4444

45-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
45+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4646
with:
4747
name: build
4848
path: build.zip
@@ -59,7 +59,7 @@ jobs:
5959

6060
steps:
6161
- name: Checkout repository
62-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
62+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6363
with:
6464
persist-credentials: false
6565

@@ -83,7 +83,7 @@ jobs:
8383
echo "::add-mask::$creds"
8484
echo "sa_key=$creds" >> "$GITHUB_OUTPUT"
8585
86-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
86+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
8787
with:
8888
name: build
8989

@@ -112,7 +112,7 @@ jobs:
112112

113113
steps:
114114
- name: Checkout repository
115-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
115+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
116116
with:
117117
persist-credentials: false
118118

.github/workflows/deploy-preview.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ jobs:
5454

5555
steps:
5656
- name: Checkout repository
57-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
57+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5858
with:
5959
ref: ${{ github.event.pull_request.head.sha }}
6060
persist-credentials: false
6161

6262
- name: Initialize CodeQL
63-
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
63+
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
6464
with:
6565
languages: ${{ matrix.language }}
6666

6767
- name: Perform CodeQL Analysis
68-
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
68+
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
6969

7070
analyze_unsafe:
7171
if: github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' && needs.precheck.outputs.is-org-member-result == 'false'
@@ -84,18 +84,18 @@ jobs:
8484

8585
steps:
8686
- name: Checkout repository
87-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
87+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8888
with:
8989
ref: ${{ github.event.pull_request.head.sha }}
9090
persist-credentials: false
9191

9292
- name: Initialize CodeQL
93-
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
93+
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
9494
with:
9595
languages: ${{ matrix.language }}
9696

9797
- name: Perform CodeQL Analysis
98-
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
98+
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
9999

100100
build:
101101
name: Build
@@ -110,7 +110,7 @@ jobs:
110110

111111
steps:
112112
- name: Checkout repository
113-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
113+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
114114
with:
115115
ref: ${{ github.event.pull_request.head.sha }}
116116
persist-credentials: false
@@ -133,7 +133,7 @@ jobs:
133133
- name: Check for tampered config
134134
run: git diff --exit-code -- firebase.json .firebaserc package.json yarn.lock 'demo/docusaurus.config.*' 'scripts/**' '.github/**'
135135

136-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
136+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
137137
with:
138138
name: build
139139
path: build.zip
@@ -154,7 +154,7 @@ jobs:
154154

155155
steps:
156156
- name: Checkout repository
157-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
157+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
158158
with:
159159
persist-credentials: false
160160

@@ -178,7 +178,7 @@ jobs:
178178
echo "::add-mask::$creds"
179179
echo "sa_key=$creds" >> "$GITHUB_OUTPUT"
180180
181-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
181+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
182182
with:
183183
name: build
184184

@@ -208,7 +208,7 @@ jobs:
208208

209209
steps:
210210
- name: Checkout repository
211-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
211+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
212212
with:
213213
ref: ${{ github.event.pull_request.head.sha }}
214214
persist-credentials: false
@@ -245,7 +245,7 @@ jobs:
245245
- name: Generate report and summary
246246
run: yarn ts-node scripts/generate-visual-diff-report.ts visual_diffs/results.json visual_diffs/index.html
247247

248-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
248+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
249249
if: always()
250250
with:
251251
name: visual_diffs

.github/workflows/pr-title-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
permissions:
2323
contents: read
2424
steps:
25-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626
with:
2727
fetch-depth: 0
2828
persist-credentials: false

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
permissions:
2525
contents: write
2626
steps:
27-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
fetch-depth: 0
3030
persist-credentials: false
@@ -48,7 +48,7 @@ jobs:
4848
contents: read
4949
steps:
5050
- name: Checkout
51-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
51+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5252
with:
5353
fetch-depth: 0
5454
persist-credentials: false
@@ -75,7 +75,7 @@ jobs:
7575
git checkout main
7676
- name: Installation
7777
if: steps.packages_changed.outputs.changed == 'true'
78-
run: yarn && yarn build-packages
78+
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts && yarn build-packages
7979
- name: Publish Canary release
8080
if: steps.packages_changed.outputs.changed == 'true'
8181
run: yarn canary

.github/workflows/validate.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ env:
1111

1212
permissions: {}
1313

14+
concurrency:
15+
group: validate-${{ github.head_ref || github.sha }}
16+
cancel-in-progress: true
17+
1418
jobs:
1519
prepare-yarn-cache:
1620
if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' }}
@@ -19,7 +23,7 @@ jobs:
1923
permissions:
2024
contents: read
2125
steps:
22-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2327
with:
2428
persist-credentials: false
2529
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
@@ -43,13 +47,13 @@ jobs:
4347
permissions:
4448
contents: read
4549
steps:
46-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
50+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4751
with:
4852
persist-credentials: false
4953
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
5054
with:
5155
node-version: "22"
52-
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
56+
- uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
5357
with:
5458
path: |
5559
node_modules
@@ -70,13 +74,13 @@ jobs:
7074
permissions:
7175
contents: read
7276
steps:
73-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
77+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7478
with:
7579
persist-credentials: false
7680
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
7781
with:
7882
node-version: "22"
79-
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
83+
- uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
8084
with:
8185
path: |
8286
node_modules
@@ -95,13 +99,13 @@ jobs:
9599
permissions:
96100
contents: read
97101
steps:
98-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
102+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
99103
with:
100104
persist-credentials: false
101105
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
102106
with:
103107
node-version: "22"
104-
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
108+
- uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
105109
with:
106110
path: |
107111
node_modules

0 commit comments

Comments
 (0)