Skip to content

Commit b87a4e4

Browse files
committed
fix(ci): pin GitHub Actions to commit SHAs and restrict GITHUB_TOKEN permissions
Resolve OpenSSF Scorecard alerts for TokenPermissions and PinnedDependencies by pinning all GitHub Actions to commit SHAs, hash-pinning pip install commands, and moving write permissions from workflow-level to job-level.
1 parent 43d8045 commit b87a4e4

7 files changed

Lines changed: 19 additions & 14 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
steps:
3333
- name: 'Harden Runner'
34-
uses: 'step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594' # v2.16.0
34+
uses: 'step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d' # v2.16.1
3535
with:
3636
egress-policy: 'audit'
3737

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: 'ubuntu-latest'
1212
steps:
1313
- name: 'Harden Runner'
14-
uses: 'step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594' # v2.16.0
14+
uses: 'step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d' # v2.16.1
1515
with:
1616
egress-policy: 'audit'
1717

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ jobs:
3232
python-version: '3.12'
3333

3434
- name: 'Install dependencies'
35-
run: 'pip install mkdocs mkdocs-material'
35+
run: |
36+
pip install --require-hashes --requirement /dev/stdin <<< "mkdocs==1.6.1 --hash=sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e"
37+
pip install --require-hashes --requirement /dev/stdin <<< "mkdocs-material==9.7.6 --hash=sha256:71b84353921b8ea1ba84fe11c50912cc512da8fe0881038fcc9a0761c0e635ba"
3638
3739
- name: 'Generate docs structure'
3840
run: 'python3 tools/build-docs'

.github/workflows/lf-build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ on:
1515
- 'v*'
1616

1717
# modify the default permissions granted to the GITHUB_TOKEN
18-
permissions:
19-
contents: 'read' # to checkout the code
20-
packages: 'write' # to push to GitHub Container Registry
18+
permissions: 'read-all'
2119

2220
jobs:
2321

2422
build:
2523
runs-on: 'ubuntu-latest'
24+
permissions:
25+
contents: 'read' # to checkout the code
26+
packages: 'write' # to push to GitHub Container Registry
2627

2728
steps:
2829

@@ -70,7 +71,7 @@ jobs:
7071
- name: 'Install Ansible Builder'
7172
run: |
7273
python3 -m pip install --upgrade pip
73-
pip install ansible-builder
74+
pip install --require-hashes --requirement /dev/stdin <<< "ansible-builder==3.1.1 --hash=sha256:a8246022edb92ca27ea95e87c7af30bcb2752f108dcc75fbf96e77196dff1072"
7475
7576
- name: 'Strip badges from README.md (not rendered correctly on Galaxy)'
7677
run: |

.github/workflows/lf-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ on:
66
- 'v*'
77

88
# modify the default permissions granted to the GITHUB_TOKEN
9-
permissions:
10-
contents: 'write' # to push to the repo and create the release
9+
permissions: 'read-all'
1110

1211
jobs:
1312
release:
1413
runs-on: 'ubuntu-latest'
14+
permissions:
15+
contents: 'write' # to push to the repo and create the release
1516

1617
steps:
1718

.github/workflows/pre-commit-autoupdate.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ on:
55
- cron: '0 8 * * 1'
66
workflow_dispatch: {}
77

8-
permissions:
9-
contents: 'write'
10-
pull-requests: 'write'
8+
permissions: 'read-all'
119

1210
jobs:
1311
update:
1412
runs-on: 'ubuntu-latest'
13+
permissions:
14+
contents: 'write'
15+
pull-requests: 'write'
1516
steps:
1617
- name: Harden the runner (Audit all outbound calls)
1718
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
@@ -27,7 +28,7 @@ jobs:
2728
python-version: '3.12'
2829

2930
- name: 'Install pre-commit'
30-
run: 'pip install pre-commit'
31+
run: 'pip install --require-hashes --requirement /dev/stdin <<< "pre-commit==4.5.1 --hash=sha256:3b3afd891e97337708c1674210f8eba659b52a38ea5f822ff142d10786221f77"'
3132

3233
- name: 'Run pre-commit autoupdate'
3334
run: 'pre-commit autoupdate'

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: 'Harden Runner'
20-
uses: 'step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594' # v2.16.0
20+
uses: 'step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d' # v2.16.1
2121
with:
2222
egress-policy: 'audit'
2323

0 commit comments

Comments
 (0)