Skip to content

Commit 6312d77

Browse files
authored
Merge pull request #73 from DevilsDev/security/github-actions-pinning
security: pin GitHub Actions to commit hashes and fix deprecated actions
2 parents de493da + 1b824ff commit 6312d77

29 files changed

+6383
-17267
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,27 @@ jobs:
3939
with:
4040
egress-policy: audit
4141

42-
- name: ⬇️ Checkout code
43-
uses: actions/checkout@v4
42+
- name: Checkout code
43+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
4444
with:
4545
persist-credentials: false
4646
fetch-depth: 1
4747

4848
- name: 🟢 Setup Node.js
49-
uses: actions/setup-node@v4
49+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
5050
with:
5151
node-version: ${{ env.NODE_VERSION }}
5252
cache: npm
5353
registry-url: https://registry.npmjs.org/
5454
cache-dependency-path: package-lock.json
5555

56-
- name: 📦 Install dependencies
57-
run: npm ci
56+
- name: Clear npm cache
57+
run: npm cache clean --force
58+
shell: bash
59+
60+
- name: Install dependencies
61+
run: |
62+
npm ci --no-optional --no-audit --prefer-offline
5863
shell: bash
5964

6065
- name: 🧹 Lint
@@ -68,14 +73,14 @@ jobs:
6873

6974
- name: Upload JUnit
7075
if: always()
71-
uses: actions/upload-artifact@v4
76+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
7277
with:
7378
name: junit
7479
path: junit.xml
7580

7681
- name: Upload coverage
7782
if: always()
78-
uses: actions/upload-artifact@v4
83+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
7984
with:
8085
name: coverage
8186
path: coverage
@@ -85,21 +90,23 @@ jobs:
8590
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
8691
timeout-minutes: 5
8792
runs-on: ubuntu-latest
93+
permissions:
94+
contents: read
8895
steps:
8996
- name: Harden runner
9097
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
9198
with:
9299
egress-policy: audit
93100

94101
- name: Download coverage
95-
uses: actions/download-artifact@v4
102+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
96103
with:
97104
name: coverage
98105
path: coverage
99106
continue-on-error: true
100107

101108
- name: Upload to Codecov
102-
uses: codecov/codecov-action@v4
109+
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
103110
with:
104111
token: ${{ secrets.CODECOV_TOKEN }}
105112
fail_ci_if_error: false

.github/workflows/comprehensive-testing.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
cache-key: ${{ steps.cache-key.outputs.key }}
5353
steps:
5454
- name: Checkout code
55-
uses: actions/checkout@v4
55+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5656
- name: Setup Node.js
57-
uses: actions/setup-node@v4
57+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
5858
with:
5959
node-version: ${{ env.NODE_VERSION }}
6060
cache: npm
@@ -67,7 +67,7 @@ jobs:
6767
echo "key=node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}" >> "$GITHUB_OUTPUT"
6868
shell: bash
6969
- name: Cache dependencies
70-
uses: actions/cache@v4
70+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
7171
with:
7272
path: ~/.npm
7373
key: ${{ steps.cache-key.outputs.key }}
@@ -114,9 +114,9 @@ jobs:
114114
- 22
115115
steps:
116116
- name: Checkout code
117-
uses: actions/checkout@v4
117+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
118118
- name: Setup Node.js ${{ matrix.node-version }}
119-
uses: actions/setup-node@v4
119+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
120120
with:
121121
node-version: ${{ matrix.node-version }}
122122
cache: npm
@@ -133,15 +133,15 @@ jobs:
133133
npm run test:unit:coverage
134134
shell: bash
135135
- name: Upload coverage reports
136-
uses: codecov/codecov-action@v4
136+
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
137137
if: matrix.node-version == 20
138138
with:
139139
file: ./coverage/lcov.info
140140
flags: unit-tests
141141
name: unit-tests-coverage
142142
- name: Upload failure logs
143143
if: failure()
144-
uses: actions/upload-artifact@v4
144+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
145145
with:
146146
name: unit-test-failure-logs-${{ matrix.node-version }}-${{ github.run_number }}
147147
path: |
@@ -173,9 +173,9 @@ jobs:
173173
- "6379:6379"
174174
steps:
175175
- name: Checkout code
176-
uses: actions/checkout@v4
176+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
177177
- name: Setup Node.js
178-
uses: actions/setup-node@v4
178+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
179179
with:
180180
node-version: ${{ env.NODE_VERSION }}
181181
cache: npm
@@ -201,7 +201,7 @@ jobs:
201201
npm run test:integration:coverage
202202
shell: bash
203203
- name: Upload integration test results
204-
uses: actions/upload-artifact@v4
204+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
205205
if: always()
206206
with:
207207
name: integration-test-results
@@ -221,9 +221,9 @@ jobs:
221221
contents: read
222222
steps:
223223
- name: Checkout code
224-
uses: actions/checkout@v4
224+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
225225
- name: Setup Node.js
226-
uses: actions/setup-node@v4
226+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
227227
with:
228228
node-version: ${{ env.NODE_VERSION }}
229229
cache: npm
@@ -240,7 +240,7 @@ jobs:
240240
npm run benchmark:cpu
241241
shell: bash
242242
- name: Upload performance results
243-
uses: actions/upload-artifact@v4
243+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
244244
if: always()
245245
with:
246246
name: performance-results
@@ -255,9 +255,9 @@ jobs:
255255
if: contains(fromJson(needs.setup.outputs.test-matrix), 'security')
256256
steps:
257257
- name: Checkout code
258-
uses: actions/checkout@v4
258+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
259259
- name: Setup Node.js
260-
uses: actions/setup-node@v4
260+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
261261
with:
262262
node-version: ${{ env.NODE_VERSION }}
263263
cache: npm
@@ -281,7 +281,7 @@ jobs:
281281
npm audit --audit-level=moderate --json > audit-results.json || true
282282
shell: bash
283283
- name: Upload security results
284-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
284+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
285285
if: always()
286286
with:
287287
name: security-test-results
@@ -297,9 +297,9 @@ jobs:
297297
if: contains(fromJson(needs.setup.outputs.test-matrix), 'property-based')
298298
steps:
299299
- name: Checkout code
300-
uses: actions/checkout@v4
300+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
301301
- name: Setup Node.js
302-
uses: actions/setup-node@v4
302+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
303303
with:
304304
node-version: ${{ env.NODE_VERSION }}
305305
cache: npm
@@ -317,7 +317,7 @@ jobs:
317317
PROPERTY_TESTING: true
318318
shell: bash
319319
- name: Upload property test results
320-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
320+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
321321
if: always()
322322
with:
323323
name: property-test-results
@@ -341,9 +341,9 @@ jobs:
341341
- 22
342342
steps:
343343
- name: Checkout code
344-
uses: actions/checkout@v4
344+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
345345
- name: Setup Node.js ${{ matrix.node-version }}
346-
uses: actions/setup-node@v4
346+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
347347
with:
348348
node-version: ${{ matrix.node-version }}
349349
cache: npm
@@ -360,7 +360,7 @@ jobs:
360360
NODE_ENV: test
361361
shell: bash
362362
- name: Upload compatibility results
363-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
363+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
364364
if: always()
365365
with:
366366
name: compatibility-test-results-${{ matrix.os }}-${{ matrix.node-version }}
@@ -381,9 +381,9 @@ jobs:
381381
if: always() && (github.event.inputs.generate_reports == 'true' || github.event.inputs.generate_reports == '')
382382
steps:
383383
- name: Checkout code
384-
uses: actions/checkout@v4
384+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
385385
- name: Setup Node.js
386-
uses: actions/setup-node@v4
386+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
387387
with:
388388
node-version: ${{ env.NODE_VERSION }}
389389
cache: npm
@@ -392,7 +392,7 @@ jobs:
392392
run: npm ci
393393
shell: bash
394394
- name: Download all test artifacts
395-
uses: actions/download-artifact@v4
395+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
396396
with:
397397
path: test-artifacts
398398
- name: Generate comprehensive test report
@@ -408,7 +408,7 @@ jobs:
408408
GITHUB_REF: "\"${{ github.ref }}\""
409409
shell: bash
410410
- name: Upload HTML reports
411-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
411+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
412412
with:
413413
name: test-reports-html
414414
path: test-reports/
@@ -491,7 +491,7 @@ jobs:
491491
});
492492
- name: Slack notification
493493
if: failure() && github.ref == 'refs/heads/main'
494-
uses: 8398a7/action-slack@28ba43ae48961b90ced0e7aac97fc847a4ab1666
494+
uses: 8398a7/action-slack@v3
495495
with:
496496
status: failure
497497
channel: "#dev-alerts"

.github/workflows/contract-validation.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ name: Contract Schema Validation (Security Hardened)
88
- src/contracts/**
99
- src/plugins/**
1010
- package.json
11-
paths-ignore:
12-
- docs/**
13-
- "*.md"
14-
- .github/ISSUE_TEMPLATE/**
11+
- "!docs/**"
12+
- "!*.md"
13+
- "!.github/ISSUE_TEMPLATE/**"
1514
pull_request:
1615
branches:
1716
- main
@@ -20,10 +19,9 @@ name: Contract Schema Validation (Security Hardened)
2019
- src/contracts/**
2120
- src/plugins/**
2221
- package.json
23-
paths-ignore:
24-
- docs/**
25-
- "*.md"
26-
- .github/ISSUE_TEMPLATE/**
22+
- "!docs/**"
23+
- "!*.md"
24+
- "!.github/ISSUE_TEMPLATE/**"
2725
workflow_dispatch:
2826
inputs:
2927
validation_type:
@@ -55,17 +53,21 @@ jobs:
5553
pull-requests: write
5654
steps:
5755
- name: Checkout code
58-
uses: actions/checkout@v4
56+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5957
with:
6058
fetch-depth: 0
6159
- name: Setup Node.js
62-
uses: actions/setup-node@v4
60+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
6361
with:
6462
node-version: ${{ env.NODE_VERSION }}
6563
cache: npm
6664
cache-dependency-path: package-lock.json
65+
- name: Clear npm cache
66+
run: npm cache clean --force
67+
shell: bash
6768
- name: Install dependencies
68-
run: npm ci
69+
run: |
70+
npm ci --no-optional --no-audit --prefer-offline
6971
shell: bash
7072
- name: Run contract schema validation tests
7173
run: |
@@ -124,7 +126,7 @@ jobs:
124126
fi
125127
shell: bash
126128
- name: Upload validation report
127-
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
129+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
128130
with:
129131
name: contract-validation-report
130132
path: contract-validation-report.md
@@ -139,14 +141,17 @@ jobs:
139141
with:
140142
path: current
141143
- name: Checkout base branch
142-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
144+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
143145
with:
144146
ref: ${{ github.base_ref || 'main' }}
145147
path: base
146148
- name: Setup Node.js
147-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
149+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
148150
with:
149151
node-version: "20"
152+
- name: Clear npm cache
153+
run: npm cache clean --force
154+
shell: bash
150155
- name: Install dependencies
151156
run: |
152157
set -e
@@ -240,7 +245,7 @@ jobs:
240245
shell: bash
241246
- name: Comment on PR with breaking change analysis
242247
if: github.event_name == 'pull_request' && failure()
243-
uses: actions/github-script@35b1cdd1b2c1fc704b1cd442536d6e4b28b2ba4e
248+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
244249
with:
245250
script: |
246251
const comment = `## 🚨 Breaking Changes Detected

.github/workflows/deploy-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ jobs:
350350
done
351351
- name: Send deployment notification
352352
if: always()
353-
uses: 8398a7/action-slack@28ba43ae48961b90ced0e3a2b7f9a3b3fb92dd30
353+
uses: 8398a7/action-slack@v3
354354
with:
355355
status: ${{ job.status }}
356356
channel: "#deployments"

.github/workflows/docs-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
2727
with:
2828
egress-policy: audit
29-
- uses: actions/checkout@v4
30-
- uses: actions/setup-node@v4
29+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
30+
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
3131
with:
3232
node-version: 20
3333
cache: npm
@@ -40,7 +40,7 @@ jobs:
4040
npm ci
4141
npm run build
4242
- name: Upload artifact
43-
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
43+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
4444
with:
4545
path: docs-site/build
4646

0 commit comments

Comments
 (0)