Skip to content

Commit 1cc9dde

Browse files
committed
feat(updater): add 2-signer release verification + local release scripts
1 parent 5702791 commit 1cc9dde

7 files changed

Lines changed: 2000 additions & 304 deletions

File tree

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ pending_videos
1313
state
1414
cameras.yaml
1515
credentials_full
16-
*.sh
16+
*.sh
17+
18+
# Firebase Service Files
19+
google-services.json
20+
GoogleService-Info.plist
21+
service_account_key.json

releases/build.sh

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,21 @@ build_and_manifest() {
145145
;;
146146
esac
147147

148+
# Compute sha256 of the final on-disk binary
149+
local BIN_SHA
150+
BIN_SHA="$(sha256sum "$ART_DIR/$BIN" | awk '{print $1}')"
151+
if [[ -z "$BIN_SHA" ]]; then
152+
echo "Failed to compute sha256 for $ART_DIR/$BIN" >&2
153+
exit 1
154+
fi
155+
148156
# Write all data to artifacts
149-
printf ' {"package":"%s","target":"%s","bin":"%s","bin_path":"%s","crate":"%s","version":"%s","crate_lock_sha256":"%s","rust_digest":"%s"}\n' \
157+
printf ' {"package":"%s","target":"%s","bin":"%s","bin_path":"%s","sha256":"%s","crate":"%s","version":"%s","crate_lock_sha256":"%s","rust_digest":"%s"}\n' \
150158
"$PKG" \
151159
"$TRIPLE" \
152160
"$BIN" \
153161
"$TRIPLE/$BIN" \
162+
"$BIN_SHA" \
154163
"$CRATE_NAME" \
155164
"$CRATE_VERSION" \
156165
"$CRATE_LOCK_SHA" \
@@ -192,12 +201,12 @@ compare_runs() {
192201
# Normalize to key = package|target|bin
193202
jq -S '[.artifacts[]
194203
| {key: (.package + "|" + .target + "|" + .bin),
195-
package, target, bin, crate, version, bin_path,
204+
package, target, bin, crate, version, bin_path, sha256,
196205
crate_lock_sha256, rust_digest}]' "$M1" > "$RUN1/keys.json"
197206

198207
jq -S '[.artifacts[]
199208
| {key: (.package + "|" + .target + "|" + .bin),
200-
package, target, bin, crate, version, bin_path,
209+
package, target, bin, crate, version, bin_path, sha256,
201210
crate_lock_sha256, rust_digest}]' "$M2" > "$RUN2/keys.json"
202211

203212

@@ -233,7 +242,7 @@ compare_runs() {
233242
fi
234243

235244
# Load in data from the manifest files relevant to our checks
236-
local PKG TGT BIN CRATE1 VER1 P1 LOCK1 DIG1 CRATE2 VER2 P2 LOCK2 DIG2
245+
local PKG TGT BIN CRATE1 VER1 P1 LOCK1 DIG1 CRATE2 VER2 P2 LOCK2 DIG2 SHA1 SHA2
237246
PKG="$(jq -r '.package' <<<"$A")"
238247
TGT="$(jq -r '.target' <<<"$A")"
239248
BIN="$(jq -r '.bin' <<<"$A")"
@@ -243,12 +252,14 @@ compare_runs() {
243252
P1="$RUN1/$(jq -r '.bin_path' <<<"$A")"
244253
LOCK1="$(jq -r '.crate_lock_sha256' <<<"$A")"
245254
DIG1="$(jq -r '.rust_digest' <<<"$A")"
255+
SHA1="$(jq -r '.sha256 // empty' <<<"$A")"
246256

247257
CRATE2="$(jq -r '.crate' <<<"$B")"
248258
VER2="$(jq -r '.version' <<<"$B")"
249259
P2="$RUN2/$(jq -r '.bin_path' <<<"$B")"
250260
LOCK2="$(jq -r '.crate_lock_sha256' <<<"$B")"
251261
DIG2="$(jq -r '.rust_digest' <<<"$B")"
262+
SHA2="$(jq -r '.sha256 // empty' <<<"$B")"
252263

253264
# metadata checks
254265
local meta_ok=1
@@ -292,6 +303,25 @@ compare_runs() {
292303
fi
293304
done < "$SMALL_DIR/keys.txt"
294305

306+
if [[ -z "$SHA1" || -z "$SHA2" ]]; then
307+
echo "FAIL: manifest missing sha256 for $PKG | $TGT | $BIN"
308+
status=1; continue
309+
fi
310+
311+
if [[ "$H1" != "$SHA1" ]]; then
312+
echo "FAIL: run1 manifest sha256 does not match file for $PKG | $TGT | $BIN"
313+
echo " manifest: $SHA1"
314+
echo " file : $H1"
315+
status=1; continue
316+
fi
317+
318+
if [[ "$H2" != "$SHA2" ]]; then
319+
echo "FAIL: run2 manifest sha256 does not match file for $PKG | $TGT | $BIN"
320+
echo " manifest: $SHA2"
321+
echo " file : $H2"
322+
status=1; continue
323+
fi
324+
295325
# Extras in the larger run
296326
local EXTRAS
297327
EXTRAS="$(comm -13 "$SMALL_DIR/keys.txt" "$LARGE_DIR/keys.txt" || true)"

server/src/lib.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)