mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
Hex polls anoma.ly/release/hex/desktop/<channel>.json on every OS and decides with the release protocol's client rules (the service's shared test vectors in tests/fixtures/release-protocol): strictly newer unless revoked, the minimum version before rollout, and a device-local rollout bucket that is never sent. Direct installs (Linux and Windows with the installer's receipt, macOS a replaceable Hex.app) download resumably, check size and SHA-256, then the OS code signature (macOS app/update-requirement.txt: Developer ID 5NZ4Q7NXJ4, anomaly.hex, notarized; Windows Authenticode from Anomaly's Artifact Signing identity), and stage the update for Restart to update. macOS swaps the bundle in with renamex_np(RENAME_SWAP) at restart or quit; a read-only location links to the DMG. Package-managed installs show their manager's command; source and test builds never check; DisableUpdates (macOS defaults, Windows policy key) turns checks off. Sparkle, its framework, Info.plist keys, appcast generation, and the ed25519 feeds are gone. release-app.sh prepare leaves Hex-<v>-macos-arm64.dmg and .zip (root Hex.app). Macs on 2.3.1 get packaging/macos/legacy-appcast.xml: one informational item linking to anoma.ly/hex.
56 lines
3.1 KiB
Shell
Executable file
56 lines
3.1 KiB
Shell
Executable file
#!/bin/sh
|
|
set -eu
|
|
|
|
if [ "$#" -ne 4 ]; then
|
|
echo "Usage: $0 <Hex.app path> <expected bundle name> <version> <build>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
bundle=$1
|
|
expected_name=$2
|
|
version=$3
|
|
build_number=$4
|
|
team_id=${VOICE_CONTROL_TEAM_ID:?Set VOICE_CONTROL_TEAM_ID to the Apple Developer signing team}
|
|
plist="$bundle/Contents/Info.plist"
|
|
|
|
fail() {
|
|
echo "Rust HEX bundle validation failed: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
plist_value() {
|
|
/usr/libexec/PlistBuddy -c "Print :$1" "$plist"
|
|
}
|
|
|
|
[ -d "$bundle" ] || fail "$bundle does not exist"
|
|
[ "$(basename "$bundle")" = "$expected_name" ] || fail "expected $expected_name, found $(basename "$bundle")"
|
|
[ "$(plist_value CFBundleIdentifier)" = anomaly.hex ] || fail "wrong bundle identifier"
|
|
[ "$(plist_value CFBundleExecutable)" = hex ] || fail "wrong executable name"
|
|
[ "$(plist_value CFBundleDisplayName)" = Hex ] || fail "wrong display name"
|
|
[ "$(plist_value CFBundleName)" = Hex ] || fail "wrong bundle name"
|
|
[ "$(plist_value CFBundleShortVersionString)" = "$version" ] || fail "wrong version"
|
|
[ "$(plist_value CFBundleVersion)" = "$build_number" ] || fail "wrong build number"
|
|
[ "$(plist_value LSMinimumSystemVersion)" = 15.0 ] || fail "wrong minimum macOS"
|
|
# Hex updates itself through the Anomaly release service; Sparkle is gone.
|
|
! plist_value SUFeedURL >/dev/null 2>&1 || fail "a Sparkle feed is still configured"
|
|
[ ! -e "$bundle/Contents/Frameworks/Sparkle.framework" ] || fail "Sparkle.framework is still bundled"
|
|
[ "$(plist_value LSUIElement)" = true ] || fail "menu-bar application policy is disabled"
|
|
[ -x "$bundle/Contents/MacOS/hex" ] || fail "packaged executable is missing"
|
|
[ "$(lipo -archs "$bundle/Contents/MacOS/hex")" = arm64 ] || fail "packaged executable is not arm64-only"
|
|
[ -x "$bundle/Contents/Library/HexMicrophone.driver/Contents/MacOS/HexMicrophoneDriver" ] || fail "bundled HexMicrophone.driver is missing"
|
|
[ "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$bundle/Contents/Library/HexMicrophone.driver/Contents/Info.plist")" = anomaly.hex.microphone.driver ] || fail "bundled driver has wrong bundle identifier"
|
|
[ "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$bundle/Contents/Library/HexMicrophone.driver/Contents/Info.plist")" = "$version" ] || fail "bundled driver has wrong version"
|
|
|
|
codesign --verify --deep --strict --verbose=2 "$bundle"
|
|
signature=$(codesign -d --verbose=4 "$bundle" 2>&1)
|
|
printf '%s\n' "$signature" | grep -Fq 'Identifier=anomaly.hex' || fail "code signature has the wrong identifier"
|
|
printf '%s\n' "$signature" | grep -Fq "TeamIdentifier=$team_id" || fail "code signature has the wrong team"
|
|
printf '%s\n' "$signature" | grep -Fq 'Authority=Developer ID Application:' || fail "not signed for Developer ID distribution"
|
|
entitlements=$(codesign -d --entitlements - "$bundle" 2>/dev/null)
|
|
printf '%s\n' "$entitlements" | grep -Fq 'com.apple.security.device.audio-input' || fail "microphone entitlement is missing"
|
|
printf '%s\n' "$entitlements" | grep -Fq 'com.apple.security.automation.apple-events' || fail "automation entitlement is missing"
|
|
if printf '%s\n' "$entitlements" | grep -Fq 'com.apple.security.app-sandbox'; then
|
|
fail "Rust application must not be sandboxed"
|
|
fi
|
|
|
|
echo "$bundle"
|