Repository navigation
fix(bootstrap): verify the Vintage Story client in the scripts and the launcher - #717
Merged
Merged
Conversation
…e launcher The pins in forks.json (vintageStoryPins) now reach every consumer of the client, not only the installer. bootstrap.sh and bootstrap.ps1 verify the archive before they extract it: a cached copy, a fresh download under its real name rather than the .partial name it has while downloading, and an archive passed explicitly under its official name. A copy that does not match is downloaded again, or rejected when the caller supplied it. They also verify the pristine VintagestoryLib.vanilla.dll after extracting and before reusing an extraction. Pins that exist but cannot be read (python3 missing, forks.json unreadable) are an error, never "unverified", and a version without pins only warns. The helpers live in scripts/_vanilla_pins.sh, which package-linux.sh and package-macos.sh use too, so a standalone make package verifies the archive it extracts. The scripts unlink a link at .vanilla, .vanilla/win-x64 or the client folder instead of deleting through it, and package.ps1 no longer falls back to an unverified legacy .vanilla/vintagestory folder. Optimum.exe embeds forks.json and checks the game's VintagestoryAPI.dll and VintagestoryLib.dll before it patches, choosing the pins by the game's own version (assets/version-x.y.z.txt) so a build against another version is not refused. A mismatch stops the launch with a message that names the file, instead of failing inside the patcher. OPTIMUM_SKIP_VANILLA_CHECK=1 skips the check for developers whose tree was changed by make deploy. scripts/tests/vanilla-pins.sh and .ps1 test the helpers under bash and under Windows PowerShell 5.1 and 7, and ci-scripts.yml runs them on Linux, macOS and Windows. A change to forks.json now triggers them.
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.
Summary
#716 made the installer verify the Vintage Story client against the checksums pinned in
forks.json. This PR carries the same check to the other consumers of the client:bootstrap.sh,bootstrap.ps1, the Linux and macOS package scripts, and the launcher, which patches the game'sVintagestoryAPI.dllandVintagestoryLib.dllon a cache miss.Scripts
bootstrap.shandbootstrap.ps1verify the archive before extracting it: a cached copy, a fresh download checked under its real name (not the.partialname it has while downloading), and an archive passed with--client-archiveor-ClientArchiveunder its official name. A cached copy that does not match is downloaded again, and an archive the caller supplied is rejected. They also check the pristineVintagestoryLib.vanilla.dllafter extracting and before reusing an extraction.scripts/_vanilla_pins.sh, whichpackage-linux.shandpackage-macos.shalso use, so a standalonemake packageverifies the archive it extracts..vanilla,.vanilla/win-x64or the client folder instead of deleting through it. An older installer pointed that folder at the game installed on the machine.package.ps1no longer falls back to an unverified legacy.vanilla/vintagestoryfolder.Launcher
Optimum.exeembedsforks.jsonand, before the patch loop, hashes the game'sVintagestoryAPI.dllandVintagestoryLib.dll(about 5 MB, only on a cache miss). A mismatch stops the launch with a message that names the file and the expected hash, instead of failing deep inside the patcher. The pins are chosen by the game's own version fromassets/version-x.y.z.txt, so a package built against a version that has no pins is not refused.OPTIMUM_SKIP_VANILLA_CHECK=1skips the check for developers whose treemake deploychanged.Tests
scripts/tests/vanilla-pins.shand.ps1run the helpers as written in the scripts against a throwaway source tree: accepted archive, wrong size, right size with another hash, a.partialfile under its real name, an unpinned name (warns), a malformed block and invalid JSON (rejected), and no pins (accepted). They also require the repository's ownforks.jsonto pin every client archive and both key files.ci-scripts.ymlruns them on Linux, macOS and Windows (Windows PowerShell 5.1 and 7), and a change toforks.jsontriggers them.VanillaIntegrityTestscovers the official files, each file mismatching, a missing file, a game of a version without pins, the skip variable, a malformed block, and the pins that travel inside the launcher.install-windows.ps1on this branch launched with an empty patch cache and passed the check.Not run by me: the scripts on Linux and macOS (the CI jobs do), and a real
make package.