Skip to content

Commit dea6ba1

Browse files
committed
fix: code injection via template expansion (information level)
https://docs.zizmor.sh/audits/#template-injection
1 parent 2e36691 commit dea6ba1

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

.github/workflows/ci-cd.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ jobs:
209209
)
210210
- name: Set the target Git tag
211211
id: git-tag
212+
env:
213+
DIST_VERSION: ${{ steps.scm-version.outputs.dist-version }}
212214
run: |
213215
from os import environ
214216
from pathlib import Path
@@ -219,13 +221,13 @@ jobs:
219221
mode=FILE_APPEND_MODE,
220222
) as outputs_file:
221223
print(
222-
"tag=v${{
223-
steps.scm-version.outputs.dist-version
224-
}}",
224+
f"tag=v{environ['DIST_VERSION']}",
225225
file=outputs_file,
226226
)
227227
- name: Set the expected dist artifact names
228228
id: artifact-name
229+
env:
230+
DIST_VERSION: ${{ steps.scm-version.outputs.dist-version }}
229231
run: |
230232
from os import environ
231233
from pathlib import Path
@@ -239,15 +241,11 @@ jobs:
239241
mode=FILE_APPEND_MODE,
240242
) as outputs_file:
241243
print(
242-
f"sdist={sdist_file_prj_base_name !s}-${{
243-
steps.scm-version.outputs.dist-version
244-
}}.tar.gz",
244+
f"sdist={sdist_file_prj_base_name !s}-{environ['DIST_VERSION']}.tar.gz",
245245
file=outputs_file,
246246
)
247247
print(
248-
f"wheel={whl_file_prj_base_name !s}-${{
249-
steps.scm-version.outputs.dist-version
250-
}}-py3-none-any.whl",
248+
f"wheel={whl_file_prj_base_name !s}-{environ['DIST_VERSION']}-py3-none-any.whl",
251249
file=outputs_file,
252250
)
253251
@@ -269,7 +267,8 @@ jobs:
269267

270268
env:
271269
TOXENV: cleanup-dists,build-dists
272-
270+
SDIST_ARTIFACT_NAME: ${{ needs.pre-setup.outputs.sdist-artifact-name }}
271+
WHEEL_ARTIFACT_NAME: ${{ needs.pre-setup.outputs.wheel-artifact-name }}
273272
outputs:
274273
dists-base64-hash: ${{ steps.dist-hashes.outputs.combined-hash }}
275274

@@ -359,19 +358,13 @@ jobs:
359358
--quiet
360359
- name: Verify that the artifacts with expected names got created
361360
run: >-
362-
ls -1
363-
'dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}'
364-
'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
361+
ls -1 "dist/${SDIST_ARTIFACT_NAME}" "dist/${WHEEL_ARTIFACT_NAME}"
365362
- name: Generate dist hashes to be used for provenance
366363
id: dist-hashes
367364
run: >-
368365
echo "combined-hash=$(
369-
sha256sum
370-
'${{ needs.pre-setup.outputs.sdist-artifact-name }}'
371-
'${{ needs.pre-setup.outputs.wheel-artifact-name }}'
372-
| base64 -w0
373-
)"
374-
>> "${GITHUB_OUTPUT}"
366+
sha256sum "$SDIST_ARTIFACT_NAME" "$WHEEL_ARTIFACT_NAME" | base64 -w0
367+
)" >> $GITHUB_OUTPUT
375368
working-directory: dist
376369
- name: Store the distribution packages
377370
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

0 commit comments

Comments
 (0)