Skip to content

fix(bootstrap): verify the Vintage Story client in the scripts and the launcher - #717

Merged
Zaldaryon merged 1 commit into
mainfrom
fix/pin-verify-scripts-launcher
Nov 20, 2026
Merged

Zaldaryon merged 1 commit into
mainfrom
fix/pin-verify-scripts-launcher

Conversation

@Zaldaryon

Copy link
Copy Markdown
Collaborator

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's VintagestoryAPI.dll and VintagestoryLib.dll on a cache miss.

Scripts

  • bootstrap.sh and bootstrap.ps1 verify the archive before extracting it: a cached copy, a fresh download checked under its real name (not the .partial name it has while downloading), and an archive passed with --client-archive or -ClientArchive under 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 pristine VintagestoryLib.vanilla.dll after extracting and before reusing an extraction.
  • Pins that exist but cannot be read (python3 missing, a malformed block) stop the script. They are never treated as "unverified". A version with no pins only warns.
  • The helpers live in scripts/_vanilla_pins.sh, which package-linux.sh and package-macos.sh also use, 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. An older installer pointed that folder at the game installed on the machine. package.ps1 no longer falls back to an unverified legacy .vanilla/vintagestory folder.
  • Each check prints a line when it passes, so a log shows that the verification ran.

Launcher

Optimum.exe embeds forks.json and, before the patch loop, hashes the game's VintagestoryAPI.dll and VintagestoryLib.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 from assets/version-x.y.z.txt, so a package built against a version that has no pins is not refused. OPTIMUM_SKIP_VANILLA_CHECK=1 skips the check for developers whose tree make deploy changed.

Tests

  • scripts/tests/vanilla-pins.sh and .ps1 run the helpers as written in the scripts against a throwaway source tree: accepted archive, wrong size, right size with another hash, a .partial file 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 own forks.json to pin every client archive and both key files.
  • ci-scripts.yml runs them on Linux, macOS and Windows (Windows PowerShell 5.1 and 7), and a change to forks.json triggers them.
  • VanillaIntegrityTests covers 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.
  • I ran the bash tests with the real Linux archive, and the PowerShell tests under 5.1 and 7 with the real Windows archive. The launcher tests (114) pass in a bootstrapped tree. A real install built by install-windows.ps1 on 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.

…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.
@Zaldaryon
Zaldaryon merged commit dee907e into main Nov 20, 2026
45 checks passed
@Zaldaryon
Zaldaryon deleted the fix/pin-verify-scripts-launcher branch November 20, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant