Skip to content

Commit e2a4f3f

Browse files
committed
ci(smoke-test): pass workflow inputs through env vars
Move `inputs.preset`, `inputs.version`, `matrix.docker`, and `matrix.bin` into `env:` blocks so shell interpolation happens after variable expansion rather than template substitution. Closes the CodeQL actions/code-injection/critical finding on the version comparison. The values are already gated upstream (release.yml requires author_association in MEMBER/OWNER for issue_comment triggers), so this is defense-in-depth, but the pattern is cheap to follow and eliminates the rule entirely.
1 parent 7bfbe2a commit e2a4f3f

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/smoke-test.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ jobs:
2828
matrix: ${{ steps.resolve.outputs.matrix }}
2929
steps:
3030
- id: resolve
31+
env:
32+
PRESET: ${{ inputs.preset }}
3133
run: |
32-
case "${{ inputs.preset }}" in
34+
case "$PRESET" in
3335
stable)
34-
# All testable targets. win32-arm64 is excluded no GitHub-hosted
36+
# All testable targets. win32-arm64 is excluded, no GitHub-hosted
3537
# ARM Windows runner available. Build-time format verification
3638
# confirms it is a valid PE32+/Aarch64 binary.
3739
matrix='[
@@ -58,7 +60,7 @@ jobs:
5860
matrix='[{"target":"linux-x64","runner":"ubuntu-latest","bin":"./clerk"}]'
5961
;;
6062
*)
61-
echo "::error::Unknown preset: ${{ inputs.preset }}"
63+
echo "::error::Unknown preset: $PRESET"
6264
exit 1
6365
;;
6466
esac
@@ -85,15 +87,18 @@ jobs:
8587
run: chmod +x ${{ matrix.bin }}
8688
- name: Smoke test
8789
shell: bash
90+
env:
91+
EXPECTED: ${{ inputs.version }}
92+
DOCKER_IMAGE: ${{ matrix.docker }}
93+
BIN: ${{ matrix.bin }}
8894
run: |
89-
expected="${{ inputs.version }}"
90-
if [ -n "${{ matrix.docker }}" ]; then
91-
actual=$(docker run --rm -v "$PWD:/work" ${{ matrix.docker }} sh -c "apk add --no-cache libstdc++ libgcc >/dev/null 2>&1; /work/${{ matrix.bin }} --version")
95+
if [ -n "$DOCKER_IMAGE" ]; then
96+
actual=$(docker run --rm -v "$PWD:/work" "$DOCKER_IMAGE" sh -c "apk add --no-cache libstdc++ libgcc >/dev/null 2>&1; /work/$BIN --version")
9297
else
93-
actual=$(${{ matrix.bin }} --version)
98+
actual=$("$BIN" --version)
9499
fi
95-
echo "Binary reports $actual (expected $expected)"
96-
if [ "$actual" != "$expected" ]; then
97-
echo "::error::Version mismatch: expected $expected, got $actual"
100+
echo "Binary reports $actual (expected $EXPECTED)"
101+
if [ "$actual" != "$EXPECTED" ]; then
102+
echo "::error::Version mismatch: expected $EXPECTED, got $actual"
98103
exit 1
99104
fi

0 commit comments

Comments
 (0)