ci: close four release-integrity gaps - #537
Merged
Merged
Conversation
Deno was fetched from releases/latest/download with no version pin and no checksum, into every published GHCR image. It is the JS runtime yt-dlp feeds YouTube's challenge payload to, so it executes against untrusted input, and every build took whatever Deno published that day. The desktop packaging scripts already pin and verify QuickJS with the rationale written out in a comment -- Docker was the one path that did not follow it. Now pinned to v2.9.6 with a per-arch SHA256 verified before the zip is unpacked. linux-release.yml and windows-release.yml uploaded with action-gh-release, whose fail_on_unmatched_files defaults to false, and neither asserted the files existed first -- macOS is the only path that did. A missing updater asset therefore published a release that went green while the in-app updater 404'd for every installed user. Both now check every asset before uploading and set fail_on_unmatched_files. make-portable.ps1 set $PSNativeCommandErrorActionPreference, which exists only in PowerShell 7+, while CI invokes it with `powershell` -- Windows PowerShell 5.1, where it does nothing and $ErrorActionPreference does not cover native commands either. A failed CPU-torch --force-reinstall was ignored, leaving whatever torch was already resolved in place, and the zip labelled CPU shipped a non-CPU torch; the later import checks still passed because torch imports fine either way. Assert-LastExitCode now guards the venv creation and all three pip installs. The preference stays for a pwsh run. Switching the invocation to pwsh would have been the tidier fix, but nothing in this repo uses pwsh and the runner is self-hosted, so there is no way to confirm PowerShell 7 is installed there. An exit-code check works on both. trivy-action was pinned to @master, the only unpinned action in the repo while everything else is SHA-pinned. Now on v0.36.0's commit. Both Deno hashes were verified against the published artifacts, including a negative control confirming a wrong hash is rejected. Refs #517
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #517. Independent; branches off
0.16.1.1. Deno pinned and checksummed
build/Dockerfile:38fetched fromreleases/latest/download/with no version pin and no checksum, into every published GHCR image. Deno is the JS runtime yt-dlp feeds YouTube's challenge payload to, so it executes against untrusted input.The project's own standard already covers this --
make-runtime-pack.sh:186-194pins QuickJS by asset and SHA256 and verifies withshasum -c, with the rationale written out in a comment. Docker was the one path that did not follow it.Now pinned to
v2.9.6with a per-arch SHA256, verified before unpacking:Both verified against the published artifacts, including a negative control confirming a wrong hash is rejected by the exact
sha256sum -cform the Dockerfile uses.2. Releases can no longer publish an incomplete asset set
action-gh-releasedefaultsfail_on_unmatched_filesto false, and neither Linux nor Windows asserted its files existed first -- macOS has 8test -fchecks, those two had none.A missing updater asset therefore published a release that went green while the in-app updater 404'd for every installed user.
Both workflows now verify every asset before uploading, and set
fail_on_unmatched_files: trueas a second line.3. PowerShell failures are no longer ignored
make-portable.ps1:12set$PSNativeCommandErrorActionPreference, which exists only in PowerShell 7+. CI invokes the script withpowershell-- Windows PowerShell 5.1 -- where it does nothing, and$ErrorActionPreferencedoes not cover native commands either.A failed CPU-torch
--force-reinstallwas ignored, leaving whatever torch was already resolved in place, so the zip labelled CPU shipped a non-CPU torch. The later import checks still passed, because torch imports fine either way.Assert-LastExitCodenow guards the venv creation and all three pip installs.Why not just switch to
pwsh: that was the tidier fix, but nothing in this repo usespwshand the runner is self-hosted, so there is no way for me to confirm PowerShell 7 is installed there. Switching could break the release outright. An exit-code check works on both versions.4. trivy-action pinned
ci.yml:181,193used@master-- the only unpinned action in the repo, while everything else is SHA-pinned. Now on v0.36.0's commited142fd.Verification
Two things I could not verify locally, worth noting:
pwshis not installed on this machine, somake-portable.ps1was edited without a parser pass. The changes are a function definition and four call sites, but a second pair of eyes on that file would be worth having.sha256sum -csequence outside a container, but the layer itself has not been exercised.