Skip to content

Commit 57e85ec

Browse files
🩹[Patch]: Update GitHub Actions security and linting configuration (#36)
This update improves the security posture of GitHub Actions workflows by addressing zizmor linting warnings. All action references are now pinned to specific commit hashes, permissions follow the principle of least privilege, and insecure workflow triggers have been replaced with safer alternatives. ## Security improvements ### Pinned action references All GitHub Actions are now pinned to specific commit SHA hashes instead of mutable tags, preventing supply chain attacks: - `actions/checkout` → `de0fac2e4500dabe0009e67214ff5f5447ce83dd` (v6.0.2) - `actions/upload-artifact` → `ea165f8d65b6e75b540449e92b4886f43607fa02` (v4.6.2) - `super-linter/super-linter` → `d5b0a2ab116623730dd094f15ddc1b6b25bf7b99` (v8.3.2) - `super-linter/super-linter/slim` → `2bdd90ed3262e023ac84bf8fe35dc480721fc1f2` (v8.2.1) - `PSModule/Auto-Release` → `eabd533035e2cb9822160f26f2eda584bd012356` (v1.9.5) - `PSModule/Install-PSModuleHelpers` → `d60d63e4be477d1ca0c67c6085101fb109bce8f1` (v1.0.6) ### Workflow trigger security Changed `pull_request_target` to `pull_request` in Auto-Release workflow to prevent potential code injection attacks from forked repositories. ### Least privilege permissions Moved `statuses: write` permission from workflow-level to job-level in Action-Test workflow, applying it only to the `ActionTestDefault` job that actually requires it for the linter. ### Credential persistence Added `persist-credentials: false` to checkout steps to prevent credential persistence in artifacts. ## Linting configuration - Enabled `VALIDATE_GITHUB_ACTIONS_ZIZMOR` in Linter workflow (previously disabled) - Updated dependabot schedule to daily with 7-day cooldown for better dependency management
1 parent 15dc407 commit 57e85ec

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ updates:
1111
- dependencies
1212
- github-actions
1313
schedule:
14-
interval: weekly
14+
interval: daily
15+
cooldown:
16+
default-days: 7

.github/workflows/Action-Test.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,20 @@ concurrency:
2020

2121
permissions:
2222
contents: read # to checkout the repo
23-
statuses: write # to create commit status
2423

2524
jobs:
2625
UploadArtifact:
2726
name: Upload Artifact
2827
runs-on: ubuntu-latest
2928
steps:
3029
- name: Checkout repo
31-
uses: actions/checkout@v6
30+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3231
with:
3332
persist-credentials: false
3433
fetch-depth: 0
3534

3635
- name: Upload module artifact
37-
uses: actions/upload-artifact@v5
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3837
with:
3938
name: module
4039
path: tests/srcTestRepo/outputs/module
@@ -45,9 +44,12 @@ jobs:
4544
name: Action-Test - [Default]
4645
runs-on: ubuntu-latest
4746
needs: UploadArtifact
47+
permissions:
48+
contents: read
49+
statuses: write # to create commit status from linter
4850
steps:
4951
- name: Checkout repo
50-
uses: actions/checkout@v6
52+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5153
with:
5254
persist-credentials: false
5355
fetch-depth: 0
@@ -59,7 +61,7 @@ jobs:
5961
WorkingDirectory: tests/srcTestRepo
6062

6163
- name: Lint documentation
62-
uses: super-linter/super-linter/slim@v8.2.1
64+
uses: super-linter/super-linter/slim@2bdd90ed3262e023ac84bf8fe35dc480721fc1f2 # v8.2.1
6365
env:
6466
GITHUB_TOKEN: ${{ github.token }}
6567
VALIDATE_MARKDOWN: true
@@ -73,12 +75,11 @@ jobs:
7375
needs: UploadArtifact
7476
steps:
7577
- name: Checkout repo
76-
uses: actions/checkout@v6
78+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7779
with:
7880
persist-credentials: false
7981
fetch-depth: 0
8082

81-
8283
- name: Action-Test
8384
uses: ./
8485
with:

.github/workflows/Auto-Release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Auto-Release
33
run-name: "Auto-Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
44

55
on:
6-
pull_request_target:
6+
pull_request:
77
branches:
88
- main
99
types:
@@ -26,7 +26,9 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout Code
29-
uses: actions/checkout@v6
29+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30+
with:
31+
persist-credentials: false
3032

3133
- name: Auto-Release
32-
uses: PSModule/Auto-Release@v1
34+
uses: PSModule/Auto-Release@eabd533035e2cb9822160f26f2eda584bd012356 # v1.9.5

.github/workflows/Linter.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,16 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout repo
22-
uses: actions/checkout@v6
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2323
with:
2424
persist-credentials: false
2525
fetch-depth: 0
2626

2727
- name: Lint code base
28-
uses: super-linter/super-linter@latest
28+
uses: super-linter/super-linter@d5b0a2ab116623730dd094f15ddc1b6b25bf7b99 # v8.3.2
2929
env:
3030
GITHUB_TOKEN: ${{ github.token }}
31+
VALIDATE_BIOME_FORMAT: false
3132
VALIDATE_JSON_PRETTIER: false
3233
VALIDATE_MARKDOWN_PRETTIER: false
3334
VALIDATE_YAML_PRETTIER: false
34-
VALIDATE_BIOME_FORMAT: false
35-
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runs:
1919
using: composite
2020
steps:
2121
- name: Install-PSModuleHelpers
22-
uses: PSModule/Install-PSModuleHelpers@v1
22+
uses: PSModule/Install-PSModuleHelpers@d60d63e4be477d1ca0c67c6085101fb109bce8f1 # v1.0.6
2323

2424
- name: Document-PSModule
2525
shell: pwsh

0 commit comments

Comments
 (0)