Skip to content

Commit 9056582

Browse files
committed
Fix CodeQL workflow errors by pinning actions to full commit SHAs
- Create security.yml workflow with CodeQL v3 (replacing deprecated v2) - Pin all GitHub Actions to full 40-character commit SHAs as required by org policy - Updated workflows: ci.yml, codeql.yml, jekyll-gh-pages.yml, security.yml This resolves the "all actions must be pinned to a full-length commit SHA" errors and updates CodeQL actions to v3 to address the v2 deprecation warning.
1 parent eef2b3f commit 9056582

4 files changed

Lines changed: 100 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
node-version: [18.x, 20.x, 22.x]
2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2323

2424
- name: Setup Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828
cache: 'npm'
@@ -44,10 +44,10 @@ jobs:
4444
needs: test
4545

4646
steps:
47-
- uses: actions/checkout@v4
47+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
4848

4949
- name: Setup Node.js
50-
uses: actions/setup-node@v4
50+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
5151
with:
5252
node-version: '20.x'
5353
cache: 'npm'

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
6060
steps:
6161
- name: Checkout repository
62-
uses: actions/checkout@v4
62+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
6363

6464
# Add any setup steps before running the `github/codeql-action/init` action.
6565
# This includes steps like installing compilers or runtimes (`actions/setup-node`
@@ -69,7 +69,7 @@ jobs:
6969

7070
# Initializes the CodeQL tools for scanning.
7171
- name: Initialize CodeQL
72-
uses: github/codeql-action/init@v4
72+
uses: github/codeql-action/init@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4
7373
with:
7474
languages: ${{ matrix.language }}
7575
build-mode: ${{ matrix.build-mode }}
@@ -98,6 +98,6 @@ jobs:
9898
exit 1
9999
100100
- name: Perform CodeQL Analysis
101-
uses: github/codeql-action/analyze@v4
101+
uses: github/codeql-action/analyze@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4
102102
with:
103103
category: "/language:${{matrix.language}}"

.github/workflows/jekyll-gh-pages.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3131
- name: Setup Pages
32-
uses: actions/configure-pages@v5
32+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
3333
- name: Build with Jekyll
34-
uses: actions/jekyll-build-pages@v1
34+
uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697 # v1.0.13
3535
with:
3636
source: ./
3737
destination: ./_site
3838
- name: Upload artifact
39-
uses: actions/upload-pages-artifact@v3
39+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
4040

4141
# Deployment job
4242
deploy:
@@ -48,4 +48,4 @@ jobs:
4848
steps:
4949
- name: Deploy to GitHub Pages
5050
id: deployment
51-
uses: actions/deploy-pages@v4
51+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/security.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Security
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
schedule:
9+
# Run security scans weekly on Monday at 00:00 UTC
10+
- cron: '0 0 * * 1'
11+
12+
jobs:
13+
npm-audit:
14+
name: NPM Audit
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24+
with:
25+
node-version: '18.x'
26+
cache: 'npm'
27+
28+
- name: Run npm audit
29+
run: npm audit --audit-level=moderate
30+
continue-on-error: true
31+
32+
- name: Run npm audit (production only)
33+
run: npm audit --production --audit-level=high
34+
35+
codeql:
36+
name: CodeQL Analysis
37+
38+
runs-on: ubuntu-latest
39+
40+
permissions:
41+
security-events: write
42+
actions: read
43+
contents: read
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
48+
49+
- name: Initialize CodeQL
50+
uses: github/codeql-action/init@497990dfed22177a82ba1bbab381bc8f6d27058f # v3.31.6
51+
with:
52+
languages: javascript
53+
54+
- name: Perform CodeQL Analysis
55+
uses: github/codeql-action/analyze@497990dfed22177a82ba1bbab381bc8f6d27058f # v3.31.6
56+
57+
dependency-review:
58+
name: Dependency Review
59+
60+
runs-on: ubuntu-latest
61+
62+
if: github.event_name == 'pull_request'
63+
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
67+
68+
- name: Dependency Review
69+
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
70+
with:
71+
fail-on-severity: moderate
72+
73+
snyk:
74+
name: Snyk Security Scan
75+
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
81+
82+
- name: Run Snyk to check for vulnerabilities
83+
uses: snyk/actions/node@9adf32b1121593767fc3c057af55b55db032dc04 # v1.0.0
84+
continue-on-error: true
85+
env:
86+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
87+
with:
88+
args: --severity-threshold=high

0 commit comments

Comments
 (0)