diff --git a/scripts/hopper-demo-x11.py b/scripts/hopper-demo-x11.py index f71f434a9..936f8e9e7 100644 --- a/scripts/hopper-demo-x11.py +++ b/scripts/hopper-demo-x11.py @@ -20,7 +20,8 @@ import time # Keep this digest aligned with LinuxHopper.ts and rerun real-Hopper verification # before accepting another vendor build. SUPPORTED_HOPPER_SHA256 = { - "0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded" + "0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded", + "1339f9e58377442b0c6fcb0dfc3cec20d593cc557408521fad9a00dbc6b8da13", } EXPECTED_SCREEN = (1280, 1024) EXPECTED_DIALOG = (189, 370, 901, 284) diff --git a/src/application/LinuxHopper.test.ts b/src/application/LinuxHopper.test.ts index f3dbb1e50..af2e05088 100644 --- a/src/application/LinuxHopper.test.ts +++ b/src/application/LinuxHopper.test.ts @@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest"; import { installLinuxHopper, + linuxHopperLauncherDigestSupported, linuxHopperInstallDisclosure, linuxPackageManagerCommands, linuxSharedLibrariesAvailable, @@ -93,6 +94,20 @@ describe("Linux Hopper host classification", () => { }); describe("Linux Hopper installation", () => { + it.each([ + [ + "Debian and Arch", + "0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded", + ], + ["RPM", "1339f9e58377442b0c6fcb0dfc3cec20d593cc557408521fad9a00dbc6b8da13"], + ])("accepts the pinned %s launcher build", (_, digest) => { + expect(linuxHopperLauncherDigestSupported(digest)).toBe(true); + }); + + it("rejects an unverified launcher build", () => { + expect(linuxHopperLauncherDigestSupported("0".repeat(64))).toBe(false); + }); + it("discloses the exact download, integrity evidence, and privileged command", () => { expect(linuxHopperInstallDisclosure("deb", false)).toEqual({ downloadUrl: diff --git a/src/application/LinuxHopper.ts b/src/application/LinuxHopper.ts index cc9a83d12..4840ac4d5 100644 --- a/src/application/LinuxHopper.ts +++ b/src/application/LinuxHopper.ts @@ -11,8 +11,10 @@ import { execFileOutput } from "../process/ExecFileOutput.js"; const execFileAsync = promisify(execFile); const DOWNLOAD_PREFIX = "https://www.hopperapp.com:443/downloader/public/"; const MAX_PACKAGE_BYTES = 100_000_000; -const SUPPORTED_HOPPER_SHA256 = - "0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded"; +const SUPPORTED_HOPPER_SHA256 = new Set([ + "0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded", + "1339f9e58377442b0c6fcb0dfc3cec20d593cc557408521fad9a00dbc6b8da13", +]); interface LinuxHopperRelease { readonly filename: string; readonly file_length: string; @@ -262,7 +264,7 @@ export const linuxHopperBinarySupported = async ( try { const hash = createHash("sha256"); for await (const chunk of createReadStream(path)) hash.update(chunk); - return hash.digest("hex") === SUPPORTED_HOPPER_SHA256; + return linuxHopperLauncherDigestSupported(hash.digest("hex")); } catch (cause: unknown) { // best-effort cleanup: optional build probing; unreadable means unsupported. void cause; @@ -270,6 +272,10 @@ export const linuxHopperBinarySupported = async ( } }; +/** Match a launcher extracted from one of the pinned official Linux packages. */ +export const linuxHopperLauncherDigestSupported = (digest: string): boolean => + SUPPORTED_HOPPER_SHA256.has(digest); + /** Interpret ldd output conservatively so a present but broken launcher is unhealthy. */ export const linuxSharedLibrariesAvailable = (output: string): boolean => !/(?:=>\s+not found|error while loading shared libraries)/iu.test(output);