ci: fail on a printer driver mismatch and pin the Syft download

With the printer driver hashes now kept in this file, a mismatch is never a
network failure: it is either an update upstream or a replaced file. The step
logged it and built without the driver, so the next in-place update of the
`driver` release would have shipped Windows packages without remote printing
and a green run. It now fails the step. A failed download still skips the
driver, as before. It uses `exit` because the surrounding catch swallows
`throw` and, with $ErrorActionPreference = 'stop', Write-Error too.

anchore/sbom-action/download-syft, even pinned by commit, runs install.sh from
syft's `main` branch in a job with `contents: write`. The step now downloads
the syft 1.42.3 release tarball, the version the action installed, checks it
against a SHA-256 written here, and unpacks it outside the checkout that
`syft dir:.` scans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
This commit is contained in:
rustdeskandClaude Opus 5.5 committed 2026-11-29 20:36:05 +08:00
1 parent 68309f4aeb
commit 9ad60004ad
1 file changed
+13 -3
+13 -3
View File
@@ -112,7 +112,14 @@ jobs:
submodules: recursive
- name: Install Syft
uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
run: |
# Not anchore/sbom-action/download-syft: it runs install.sh from syft's `main` branch.
# Unpacked outside the checkout, which `syft dir:.` scans.
curl -fsSL -o "$RUNNER_TEMP/syft.tar.gz" https://github.com/anchore/syft/releases/download/v1.42.3/syft_1.42.3_linux_amd64.tar.gz
echo "0d6be741479eddd2c8644a288990c04f3df0d609bbc1599a005532a9dff63509 $RUNNER_TEMP/syft.tar.gz" | sha256sum -c -
mkdir -p "$RUNNER_TEMP/syft"
tar -xzf "$RUNNER_TEMP/syft.tar.gz" -C "$RUNNER_TEMP/syft" syft
echo "$RUNNER_TEMP/syft" >> "$GITHUB_PATH"
- name: Generate SBOM
run: |
@@ -367,9 +374,12 @@ jobs:
Expand-Archive printer_driver_adapter.zip -DestinationPath .
mv -Force .\printer_driver_adapter.dll ./rustdesk
} elseif ($checksum_driver -ne $downloadsum_driver.Hash) {
Write-Output "rustdesk_printer_driver_v4-1.4, checksums do not match, ignore the file."
# `exit`, not `throw` or Write-Error: the catch below would swallow those and build without the driver.
Write-Output "::error::rustdesk_printer_driver_v4-1.4.zip: SHA-256 mismatch"
exit 1
} else {
Write-Output "printer_driver_adapter.dll, checksums do not match, ignore the file."
Write-Output "::error::printer_driver_adapter.zip: SHA-256 mismatch"
exit 1
}
} catch {
Write-Host "Ingore the printer driver error."