Skip to content

Commit 4c34443

Browse files
authored
πŸ”’ ci(workflows): add zizmor security auditing (#154)
GitHub Actions workflows were vulnerable to several security issues including template injection, credential exposure, and permission over-scoping. These vulnerabilities could allow attackers to execute arbitrary code or access sensitive tokens. This change adds `zizmor` as a pre-commit hook to continuously audit workflow security and fixes all existing vulnerabilities. The fixes include pinning actions to commit hashes, moving secrets to dedicated environments, isolating GitHub context from shell execution, and restricting permissions to the minimum required scope. All workflows now pass security audit with zero findings. Future workflow changes will be automatically checked before commit.
1 parent 7cbcb63 commit 4c34443

File tree

5 files changed

+71
-36
lines changed

5 files changed

+71
-36
lines changed

β€Ž.github/dependabot.yamlβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ updates:
55
target-branch: "main"
66
schedule:
77
interval: "daily"
8+
cooldown:
9+
default-days: 7
810
- package-ecosystem: "github-actions"
911
directory: "/"
1012
target-branch: "main"
1113
schedule:
1214
interval: "daily"
15+
cooldown:
16+
default-days: 7

β€Ž.github/workflows/auto-merge.yamlβ€Ž

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Auto-merge
22
on:
3-
pull_request_target:
3+
pull_request:
44
types: [opened, synchronize, reopened]
55

66
permissions: {}
@@ -9,7 +9,12 @@ jobs:
99
auto-merge:
1010
name: 🀝 Auto-merge
1111
runs-on: ubuntu-latest
12-
if: github.actor == 'gaborbernat' || github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' || github.actor == 'github-actions[bot]'
12+
environment: auto-merge
13+
if: >-
14+
github.event.pull_request.user.login == 'gaborbernat' ||
15+
github.event.pull_request.user.login == 'dependabot[bot]' ||
16+
github.event.pull_request.user.login == 'pre-commit-ci[bot]' ||
17+
github.event.pull_request.user.login == 'github-actions[bot]'
1318
steps:
1419
- name: πŸ”€ Enable auto-merge
1520
run: gh pr merge --auto --squash "$PR_URL"

β€Ž.github/workflows/check.yamlβ€Ž

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: 🧹 Free disk space
20-
uses: jlumbroso/free-disk-space@main
20+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
2121
with:
2222
tool-cache: false
2323
large-packages: false
2424
- name: πŸ“₯ Checkout
25-
uses: actions/checkout@v6
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
26+
with:
27+
persist-credentials: false
2628
- name: β˜• Set up Java
27-
uses: actions/setup-java@v5
29+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
2830
with:
2931
distribution: zulu
3032
java-version: 21
3133
- name: 🐘 Set up Gradle
32-
uses: gradle/actions/setup-gradle@v6
34+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6
3335
- name: πŸ”¨ Build plugin
3436
run: ./gradlew --console=plain buildPlugin
3537
- name: πŸ“ Prepare artifact
@@ -40,7 +42,7 @@ jobs:
4042
unzip "$FILENAME" -d content
4143
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
4244
- name: πŸ“€ Upload artifact
43-
uses: actions/upload-artifact@v7
45+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
4446
with:
4547
name: ${{ steps.artifact.outputs.filename }}
4648
path: ./build/distributions/content/*/*
@@ -54,7 +56,7 @@ jobs:
5456
ide: ${{ github.event_name == 'pull_request' && fromJson('["PC"]') || fromJson('["PC", "PY"]') }}
5557
steps:
5658
- name: 🧹 Free disk space
57-
uses: jlumbroso/free-disk-space@main
59+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
5860
with:
5961
tool-cache: false
6062
large-packages: false
@@ -63,24 +65,28 @@ jobs:
6365
haskell: true
6466
docker-images: true
6567
- name: πŸ“₯ Checkout
66-
uses: actions/checkout@v6
68+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
69+
with:
70+
persist-credentials: false
6771
- name: β˜• Set up Java
68-
uses: actions/setup-java@v5
72+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
6973
with:
7074
distribution: zulu
7175
java-version: 21
7276
- name: 🐘 Set up Gradle
73-
uses: gradle/actions/setup-gradle@v6
77+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6
7478
- name: πŸ’Ύ Cache verifier IDEs
75-
uses: actions/cache@v5
79+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
7680
with:
7781
path: ~/.pluginVerifier/ides
7882
key: plugin-verifier-ides-${{ matrix.ide }}-${{ hashFiles('gradle.properties') }}
7983
- name: βœ… Run verification
80-
run: ./gradlew verifyPlugin -PverifyIde=${{ matrix.ide }}
84+
run: ./gradlew verifyPlugin -PverifyIde=${MATRIX_IDE}
85+
env:
86+
MATRIX_IDE: ${{ matrix.ide }}
8187
- name: πŸ“€ Upload results
8288
if: ${{ always() }}
83-
uses: actions/upload-artifact@v7
89+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
8490
with:
8591
name: pluginVerifier-result-${{ matrix.ide }}
8692
path: ${{ github.workspace }}/build/reports/pluginVerifier
@@ -90,19 +96,21 @@ jobs:
9096
runs-on: ubuntu-latest
9197
steps:
9298
- name: 🧹 Free disk space
93-
uses: jlumbroso/free-disk-space@main
99+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
94100
with:
95101
tool-cache: false
96102
large-packages: false
97103
- name: πŸ“₯ Checkout
98-
uses: actions/checkout@v6
104+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
105+
with:
106+
persist-credentials: false
99107
- name: β˜• Set up Java
100-
uses: actions/setup-java@v5
108+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
101109
with:
102110
distribution: zulu
103111
java-version: 21
104112
- name: 🐘 Set up Gradle
105-
uses: gradle/actions/setup-gradle@v6
113+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6
106114
- name: πŸ” Run linter
107115
run: ./gradlew ktlintCheck
108116

@@ -111,19 +119,21 @@ jobs:
111119
runs-on: ubuntu-latest
112120
steps:
113121
- name: 🧹 Free disk space
114-
uses: jlumbroso/free-disk-space@main
122+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
115123
with:
116124
tool-cache: false
117125
large-packages: false
118126
- name: πŸ“₯ Checkout
119-
uses: actions/checkout@v6
127+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
128+
with:
129+
persist-credentials: false
120130
- name: β˜• Set up Java
121-
uses: actions/setup-java@v5
131+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
122132
with:
123133
distribution: zulu
124134
java-version: 21
125135
- name: 🐘 Set up Gradle
126-
uses: gradle/actions/setup-gradle@v6
136+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6
127137
- name: βœ… Run tests with coverage
128138
run: ./gradlew test koverVerify
129139

@@ -132,19 +142,21 @@ jobs:
132142
runs-on: ubuntu-latest
133143
steps:
134144
- name: 🧹 Free disk space
135-
uses: jlumbroso/free-disk-space@main
145+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
136146
with:
137147
tool-cache: false
138148
large-packages: false
139149
- name: πŸ“₯ Checkout
140-
uses: actions/checkout@v6
150+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
151+
with:
152+
persist-credentials: false
141153
- name: β˜• Set up Java
142-
uses: actions/setup-java@v5
154+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
143155
with:
144156
distribution: zulu
145157
java-version: 21
146158
- name: 🐘 Set up Gradle
147-
uses: gradle/actions/setup-gradle@v6
159+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6
148160
- name: πŸ–₯️ Run UI tests
149161
run: |
150162
export DISPLAY=:99.0

β€Ž.github/workflows/release.yamlβ€Ž

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,40 @@ jobs:
1616
url: https://plugins.jetbrains.com/plugin/20536-pyvenv-manage-2
1717
steps:
1818
- name: πŸ“₯ Checkout
19-
uses: actions/checkout@v6
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2020
with:
2121
ref: ${{ github.event.release.tag_name }}
22+
persist-credentials: false
2223
- name: 🧹 Free disk space
23-
uses: jlumbroso/free-disk-space@main
24+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
2425
with:
2526
tool-cache: false
2627
large-packages: false
2728
- name: β˜• Set up Java
28-
uses: actions/setup-java@v5
29+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
2930
with:
3031
distribution: zulu
3132
java-version: 21
3233
- name: 🐘 Set up Gradle
33-
uses: gradle/actions/setup-gradle@v6
34+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6
3435
- name: 🏷️ Set version from tag
3536
id: version
3637
run: |
37-
VERSION="${{ github.event.release.tag_name }}"
38+
VERSION="${GITHUB_EVENT_RELEASE_TAG_NAME}"
3839
VERSION="${VERSION#v}"
3940
echo "version=$VERSION" >> $GITHUB_OUTPUT
4041
sed -i "s/^pluginVersion=.*/pluginVersion=$VERSION/" gradle.properties
42+
env:
43+
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
4144
- name: πŸ“ Update changelog
4245
if: ${{ github.event.release.body != '' }}
4346
run: |
4447
cat > /tmp/release-notes.txt << 'RELEASE_NOTES_EOF'
45-
${{ github.event.release.body }}
48+
${GITHUB_EVENT_RELEASE_BODY}
4649
RELEASE_NOTES_EOF
4750
./gradlew patchChangelog --release-note="$(cat /tmp/release-notes.txt)"
51+
env:
52+
GITHUB_EVENT_RELEASE_BODY: ${{ github.event.release.body }}
4853
- name: πŸ“€ Publish to JetBrains Marketplace
4954
env:
5055
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
@@ -55,20 +60,25 @@ jobs:
5560
- name: πŸ“Ž Upload release artifact
5661
env:
5762
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
63+
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
64+
run: gh release upload ${GITHUB_EVENT_RELEASE_TAG_NAME} ./build/distributions/*
5965
- name: πŸ”’ Calculate next dev version
6066
id: next
6167
run: |
62-
VERSION="${{ steps.version.outputs.version }}"
68+
VERSION="${STEPS_VERSION_OUTPUTS_VERSION}"
6369
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
6470
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))-dev"
6571
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
72+
env:
73+
STEPS_VERSION_OUTPUTS_VERSION: ${{ steps.version.outputs.version }}
6674
- name: πŸ“ Create post-release PR
6775
env:
6876
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
77+
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
78+
STEPS_NEXT_OUTPUTS_NEXT_VERSION: ${{ steps.next.outputs.next_version }}
6979
run: |
70-
VERSION="${{ github.event.release.tag_name }}"
71-
NEXT_VERSION="${{ steps.next.outputs.next_version }}"
80+
VERSION="${GITHUB_EVENT_RELEASE_TAG_NAME}"
81+
NEXT_VERSION="${STEPS_NEXT_OUTPUTS_NEXT_VERSION}"
7282
BRANCH="post-release-$VERSION"
7383
7484
# Save patched changelog before switching branches

β€Ž.pre-commit-config.yamlβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ repos:
1616
additional_dependencies:
1717
- prettier@3.6.2
1818
- "@prettier/plugin-xml@3.4.2"
19+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
20+
rev: v1.23.1
21+
hooks:
22+
- id: zizmor

0 commit comments

Comments
Β (0)