Skip to content

Commit 6b68856

Browse files
ci: github: Harden the test workflow by downloading into temp dir
This issue was reported by CodeQL, IMHOI the alert was over reacting because contents was already extracted in a separate directory (which is absent in tree, so there is no risk to override) An extra check would be to verify a signed asset (using GPG), along a ZWA public key shared in tree. Potential fix for code scanning alert no. 1: Artifact poisoning Origin: SiliconLabsSoftware#108 Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Relate-to: Z-Wave-Alliance/OSWG#48 (comment) Relate-to: SiliconLabsSoftware#67 Relate-to: https://github.com/rzr/z-wave-protocol-controller/security/code-scanning/1 Relate-to: https://cwe.mitre.org/data/definitions/829.html Releta-to: SiliconLabsSoftware#100 Signed-off-by: Philippe Coval <[email protected]>
1 parent 8bc24a8 commit 6b68856

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,26 @@ jobs:
2525
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2626
steps:
2727
- name: Download image
28+
id: image
2829
# yamllint disable-line rule:line-length
2930
uses: ishworkh/container-image-artifact-download@ccb3671db007622e886a2d7037eb62b119d5ffaf # v2.0.0
3031
with:
3132
image: "${{ env.project-name }}:latest"
3233
workflow: "build"
3334
token: ${{ secrets.GH_SL_ACCESS_TOKEN }}
3435
workflow_run_id: ${{ github.event.workflow_run.id }}
35-
36+
- name: Check and remove downloaded artifact
37+
# yamllint disable rule:line-length
38+
run: |
39+
set -xe
40+
file="/tmp/action_image_artifact_${{ github.event.repository.name }}_latest/${{ github.event.repository.name }}_latest"
41+
echo "Info for comparing to build artifacts"
42+
sha256sum "${file}"
43+
tar -xOf "${file}" manifest.json | jq
44+
echo "TODO: https://github.com/ishworkh/container-image-artifact-download/issues/7#issuecomment-2904751460"
45+
rm -rfv "${file}"
46+
echo "TODO: https://docs.docker.com/engine/security/trust/"
47+
# yamllint enable rule:line-length
3648
# yamllint disable-line rule:line-length
3749
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3850
with:
@@ -59,24 +71,26 @@ jobs:
5971
${{ env.debian_packages }}
6072
&& sudo apt-get clean -y
6173
&& echo "https://github.com/Z-Wave-Alliance/z-wave-stack/issues/733"
62-
&& mkdir -p z-wave-stack-binaries
74+
&& mkdir -p ${{ runner.temp }}/z-wave-stack-binaries
6375
&& tar xfz z-wave-stack-binaries-*-Linux.tar.gz
64-
-C z-wave-stack-binaries
76+
-C ${{ runner.temp }}/z-wave-stack-binaries
6577
&& rm z-wave-stack-binaries-*-Linux.tar.gz
6678
&& date -u
6779
6880
- name: Run
6981
id: run
82+
# yamllint disable rule:line-length
7083
run: |
7184
set -x
7285
export ZPC_RUN_MODE="docker"
7386
export ZPC_COMMAND="docker run ${{ env.project-name }}"
7487
$ZPC_COMMAND --version
7588
docker-compose pull
7689
export ZPC_COMMAND="docker-compose up --abort-on-container-exit"
77-
cd z-wave-stack-binaries/bin && file -E *_x86_REALTIME.elf && cd -
90+
export z_wave_stack_binaries_bin_dir="${{ runner.temp }}/z-wave-stack-binaries/bin"
7891
export ZPC_ARGS="--log.level=d"
7992
./scripts/tests/z-wave-stack-binaries-test.sh
93+
# yamllint enable rule:line-length
8094
continue-on-error: true
8195

8296
- name: Propagate run status to commit status

0 commit comments

Comments
 (0)