detached f154089

fix(security): add SHA256 checksum verification to installer

The install script now verifies downloaded artifacts against checksums.txt
from the GitHub release before extracting, protecting against corrupted
or tampered downloads.

- Downloads checksums.txt from the release
- Supports both sha256sum (Linux) and shasum (macOS)
- Fails safely with clear error messages on verification failure
commit
f154089fab7ab6c5b3f840366060b8b06b9fb7c4
author
brice · · 2026-01-17 07:55 UTC
parent
79b3461
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +39 -1
M install.sh +39 -1
@@ -49,8 +49,46 @@ DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${TARBALL}"
4949 TMP_DIR=$(mktemp -d)
5050 trap 'rm -rf "$TMP_DIR"' EXIT
5151
52+# Download checksums file
53+CHECKSUMS_URL="https://github.com/${REPO}/releases/latest/download/checksums.txt"
54+echo "Downloading checksums..."
55+if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then
56+ echo "Error: Failed to download checksums file"
57+ exit 1
58+fi
59+
5260 echo "Downloading ${TARBALL}..."
53-curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL"
61+if ! curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL"; then
62+ echo "Error: Failed to download ${TARBALL}"
63+ exit 1
64+fi
65+
66+# Verify checksum
67+echo "Verifying checksum..."
68+EXPECTED_CHECKSUM=$(grep "${TARBALL}" "$TMP_DIR/checksums.txt" | awk '{print $1}')
69+if [ -z "$EXPECTED_CHECKSUM" ]; then
70+ echo "Error: Could not find checksum for ${TARBALL} in checksums.txt"
71+ exit 1
72+fi
73+
74+# Calculate actual checksum (works on both Linux and macOS)
75+if command -v sha256sum >/dev/null 2>&1; then
76+ ACTUAL_CHECKSUM=$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')
77+elif command -v shasum >/dev/null 2>&1; then
78+ ACTUAL_CHECKSUM=$(shasum -a 256 "$TMP_DIR/$TARBALL" | awk '{print $1}')
79+else
80+ echo "Error: Neither sha256sum nor shasum found. Cannot verify checksum."
81+ exit 1
82+fi
83+
84+if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
85+ echo "Error: Checksum verification failed!"
86+ echo "Expected: $EXPECTED_CHECKSUM"
87+ echo "Actual: $ACTUAL_CHECKSUM"
88+ echo "The downloaded file may be corrupted or tampered with."
89+ exit 1
90+fi
91+echo "Checksum verified successfully."
5492
5593 echo "Extracting..."
5694 tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR"
@@ -49,8 +49,46 @@ DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${TARBALL}"
49 TMP_DIR=$(mktemp -d)49 TMP_DIR=$(mktemp -d)
50 trap 'rm -rf "$TMP_DIR"' EXIT50 trap 'rm -rf "$TMP_DIR"' EXIT
51 51
52+# Download checksums file
53+CHECKSUMS_URL="https://github.com/${REPO}/releases/latest/download/checksums.txt"
54+echo "Downloading checksums..."
55+if ! curl -fsSL "$CHECKSUMS_URL" -o "$TMP_DIR/checksums.txt"; then
56+ echo "Error: Failed to download checksums file"
57+ exit 1
58+fi
59+
52 echo "Downloading ${TARBALL}..."60 echo "Downloading ${TARBALL}..."
53-curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL"61+if ! curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL"; then
62+ echo "Error: Failed to download ${TARBALL}"
63+ exit 1
64+fi
65+
66+# Verify checksum
67+echo "Verifying checksum..."
68+EXPECTED_CHECKSUM=$(grep "${TARBALL}" "$TMP_DIR/checksums.txt" | awk '{print $1}')
69+if [ -z "$EXPECTED_CHECKSUM" ]; then
70+ echo "Error: Could not find checksum for ${TARBALL} in checksums.txt"
71+ exit 1
72+fi
73+
74+# Calculate actual checksum (works on both Linux and macOS)
75+if command -v sha256sum >/dev/null 2>&1; then
76+ ACTUAL_CHECKSUM=$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')
77+elif command -v shasum >/dev/null 2>&1; then
78+ ACTUAL_CHECKSUM=$(shasum -a 256 "$TMP_DIR/$TARBALL" | awk '{print $1}')
79+else
80+ echo "Error: Neither sha256sum nor shasum found. Cannot verify checksum."
81+ exit 1
82+fi
83+
84+if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
85+ echo "Error: Checksum verification failed!"
86+ echo "Expected: $EXPECTED_CHECKSUM"
87+ echo "Actual: $ACTUAL_CHECKSUM"
88+ echo "The downloaded file may be corrupted or tampered with."
89+ exit 1
90+fi
91+echo "Checksum verified successfully."
54 92
55 echo "Extracting..."93 echo "Extracting..."
56 tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR"94 tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR"

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close