Skip to content

Commit 35b918b

Browse files
committed
Prevent credential persistence and possible code injection via template expansion
Safety measures recommended by zizmor static analysis. See: - https://github.com/zizmorcore/zizmor
1 parent c647b6f commit 35b918b

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/draft-release-flutter.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
steps:
4444
- name: Checkout source code
4545
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
46+
with:
47+
persist-credentials: false
4648

4749
- id: gh_release
4850
name: Create a new GitHub draft release
@@ -53,7 +55,10 @@ jobs:
5355
generate_release_notes: true
5456

5557
- name: Annotate workflow run with draft release URL
56-
run: 'echo "### :shipit: Opened draft release for: [${{ inputs.slug }} ${{ github.ref_name }}](${{ steps.gh_release.outputs.url }})" >> "$GITHUB_STEP_SUMMARY"'
58+
env:
59+
INPUTS_SLUG: ${{ inputs.slug }}
60+
GH_RELEASE_URL: ${{ steps.gh_release.outputs.url }}
61+
run: 'echo "### :shipit: Opened draft release for: [${INPUTS_SLUG} ${GITHUB_REF_NAME}](${GH_RELEASE_URL})" >> "$GITHUB_STEP_SUMMARY"'
5762

5863
build_release_assets:
5964
name: build release assets
@@ -63,6 +68,8 @@ jobs:
6368
steps:
6469
- name: Checkout source code
6570
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
71+
with:
72+
persist-credentials: false
6673

6774
- name: Add Toolbox Envy to PATH
6875
uses: EarthmanMuons/toolbox-envy/.github/actions/add-to-path@main
@@ -96,7 +103,9 @@ jobs:
96103
run: flutter build apk
97104

98105
- name: Stage assets + checksums
99-
run: stage-release-assets --slug "${{ inputs.slug }}"
106+
env:
107+
INPUTS_SLUG: ${{ inputs.slug }}
108+
run: stage-release-assets --slug "${INPUTS_SLUG}"
100109

101110
- name: Upload staged dist/ as workflow artifact
102111
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
@@ -117,6 +126,8 @@ jobs:
117126
steps:
118127
- name: Checkout source code
119128
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
129+
with:
130+
persist-credentials: false
120131

121132
- name: Download staged dist/ artifact
122133
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
@@ -127,9 +138,10 @@ jobs:
127138
- name: Upload release assets
128139
env:
129140
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
DRAFT_RELEASE_UPLOAD_URL: ${{ needs.create_draft_release.outputs.upload_url }}
130142
run: |
131143
set -euo pipefail
132-
echo "Uploading assets to: ${{ needs.create_draft_release.outputs.upload_url }}"
144+
echo "Uploading assets to: ${DRAFT_RELEASE_UPLOAD_URL}"
133145
ls -la dist/
134146
gh release upload "$GITHUB_REF_NAME" dist/* --clobber
135147
echo ":arrow_up: Uploaded release assets" >>"$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)