Skip to content

Commit d73ff08

Browse files
security: fix template injection and credential persistence issues
- Add persist-credentials: false to checkout step to prevent credential leakage - Use environment variables instead of direct template expansion in shell commands - This prevents potential code injection attacks via malicious tag names Fixes identified by zizmor security scanner: - artipacked: credential persistence through GitHub Actions artifacts - template-injection: code injection via template expansion Co-authored-by: matifali <[email protected]>
1 parent a698fea commit d73ff08

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0 # Fetch full history for changelog generation
22+
persist-credentials: false
2223

2324
- name: Extract tag information
2425
id: tag_info
@@ -44,11 +45,11 @@ jobs:
4445
4546
- name: Find previous tag
4647
id: prev_tag
48+
env:
49+
NAMESPACE: ${{ steps.tag_info.outputs.namespace }}
50+
MODULE: ${{ steps.tag_info.outputs.module }}
51+
CURRENT_TAG: ${{ steps.tag_info.outputs.tag }}
4752
run: |
48-
NAMESPACE="${{ steps.tag_info.outputs.namespace }}"
49-
MODULE="${{ steps.tag_info.outputs.module }}"
50-
CURRENT_TAG="${{ steps.tag_info.outputs.tag }}"
51-
5253
# Find the previous tag for this specific module
5354
PREV_TAG=$(git tag -l "release/$NAMESPACE/$MODULE/v*" | grep -v "$CURRENT_TAG" | sort -V | tail -1)
5455
@@ -62,13 +63,13 @@ jobs:
6263
6364
- name: Generate changelog
6465
id: changelog
66+
env:
67+
NAMESPACE: ${{ steps.tag_info.outputs.namespace }}
68+
MODULE: ${{ steps.tag_info.outputs.module }}
69+
MODULE_PATH: ${{ steps.tag_info.outputs.module_path }}
70+
PREV_TAG: ${{ steps.prev_tag.outputs.prev_tag }}
71+
CURRENT_TAG: ${{ steps.tag_info.outputs.tag }}
6572
run: |
66-
NAMESPACE="${{ steps.tag_info.outputs.namespace }}"
67-
MODULE="${{ steps.tag_info.outputs.module }}"
68-
MODULE_PATH="${{ steps.tag_info.outputs.module_path }}"
69-
PREV_TAG="${{ steps.prev_tag.outputs.prev_tag }}"
70-
CURRENT_TAG="${{ steps.tag_info.outputs.tag }}"
71-
7273
echo "Generating changelog for $MODULE_PATH between $PREV_TAG and $CURRENT_TAG"
7374
7475
# Get commits that affected the specific module path
@@ -128,8 +129,11 @@ jobs:
128129
- name: Create Release
129130
env:
130131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
TAG_NAME: ${{ steps.tag_info.outputs.tag }}
133+
RELEASE_TITLE: ${{ steps.tag_info.outputs.release_title }}
134+
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
131135
run: |
132-
gh release create "${{ steps.tag_info.outputs.tag }}" \
133-
--title "${{ steps.tag_info.outputs.release_title }}" \
134-
--notes "${{ steps.changelog.outputs.changelog }}" \
136+
gh release create "$TAG_NAME" \
137+
--title "$RELEASE_TITLE" \
138+
--notes "$CHANGELOG" \
135139
--latest

0 commit comments

Comments
 (0)