Skip to content

Commit 4410475

Browse files
reberhardt7claude
andauthored
fix: harden GitHub Actions workflows (#57)
* fix: harden GitHub Actions workflows (zizmor) - Fix template injection vulnerability by using environment variables instead of direct interpolation of github.ref - Pin all third-party actions to full-length commit SHAs - Add explicit permissions (contents: write) to publish workflow - Add persist-credentials: false to checkout step - Add zizmor.yml configuration file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: update actions to latest versions and suppress false positive zizmor finding Update actions/checkout to v6.0.2 and actions/setup-node to v4.4.0 with pinned SHAs. Suppress false positive cache-poisoning finding for setup-node in publish.yml (caching is not enabled without explicit cache: config). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4bd890d commit 4410475

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
- "release/[0-9]+.[0-9]+.[0-9]+"
66

77
name: Deploy Extension
8+
9+
permissions:
10+
contents: write
11+
812
jobs:
913
deploy:
1014
runs-on: ubuntu-latest
@@ -13,18 +17,22 @@ jobs:
1317
id: releaseMode
1418
# perform secret check & put boolean result as an output
1519
shell: bash
20+
env:
21+
GIT_REF: ${{ github.ref }}
1622
run: |
17-
if [[ "${{ github.ref }}" = "refs/tags/dryrun"* ]]; then
23+
if [[ "$GIT_REF" = "refs/tags/dryrun"* ]]; then
1824
echo "dryRun=true" >> $GITHUB_OUTPUT;
1925
else
2026
echo "dryRun=false" >> $GITHUB_OUTPUT;
2127
fi
22-
- uses: actions/checkout@v3
23-
- uses: actions/setup-node@v3
28+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
persist-credentials: false
31+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2432
- run: npm ci
2533
- name: Publish to Open VSX Registry
2634
if: success() || failure()
27-
uses: HaaLeo/publish-vscode-extension@v1
35+
uses: HaaLeo/publish-vscode-extension@f4ece70f329f66686bd71c54b1671353fe320e49 # v1
2836
id: publishToOpenVSX
2937
with:
3038
dryRun: ${{ steps.releaseMode.outputs.dryRun }}
@@ -33,7 +41,7 @@ jobs:
3341
skipDuplicate: true
3442
- name: Publish to Visual Studio Marketplace
3543
if: success() || failure()
36-
uses: HaaLeo/publish-vscode-extension@v1
44+
uses: HaaLeo/publish-vscode-extension@f4ece70f329f66686bd71c54b1671353fe320e49 # v1
3745
with:
3846
dryRun: ${{ steps.releaseMode.outputs.dryRun }}
3947
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
@@ -42,7 +50,7 @@ jobs:
4250
registryUrl: https://marketplace.visualstudio.com
4351
skipDuplicate: true
4452
- name: Github Release
45-
uses: softprops/action-gh-release@v1
53+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
4654
if: ${{ ! steps.releaseMode.outputs.dryRun }}
4755
with:
4856
body: |

.github/zizmor.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rules:
2+
secrets-outside-env:
3+
disable: true
4+
cache-poisoning:
5+
ignore:
6+
- publish.yml

0 commit comments

Comments
 (0)