Repository Public
1#!/bin/bash2# Verifies a release disk image WITHOUT installing or launching anything: signatures, Gatekeeper assessment,3# stapled tickets, Hardened Runtime, sandbox, entitlements, embedded profile, and absence of Debug-only code.4# Scripts/verify-release.sh dist/macos/MacLustr-Command-Center-<version>-<build>.dmg5set -euo pipefail6DMG="$1"7fail=08check() { if "$@" >/dev/null 2>&1; then echo "ok $*"; else echo "FAIL $*"; fail=1; fi; }910echo "== disk image"11check codesign --verify --strict "$DMG"12if xcrun stapler validate "$DMG" >/dev/null 2>&1; then echo "ok stapler validate (dmg)"; else echo "FAIL stapler validate (dmg)"; fail=1; fi13spctl -a -vv -t open --context context:primary-signature "$DMG" 2>&1 | sed 's/^/ /'14spctl -a -t open --context context:primary-signature "$DMG" >/dev/null 2>&1 || { echo "FAIL spctl (dmg)"; fail=1; }15if [ -f "$DMG.sha256" ]; then (cd "$(dirname "$DMG")" && shasum -a 256 -c "$(basename "$DMG").sha256"); else echo " (no .sha256 next to the image)"; fi1617MNT="$(mktemp -d /tmp/mcc-swift-verify.XXXXXX)"18hdiutil attach -quiet -nobrowse -readonly -mountpoint "$MNT" "$DMG"19trap 'hdiutil detach -quiet "$MNT" || true' EXIT20APP="$MNT/MacLustr Command Center.app"2122echo "== application"23check codesign --verify --deep --strict --verbose=2 "$APP"24spctl -a -vv -t exec "$APP" 2>&1 | sed 's/^/ /'25spctl -a -t exec "$APP" >/dev/null 2>&1 || { echo "FAIL spctl (app)"; fail=1; }26if xcrun stapler validate "$APP" >/dev/null 2>&1; then echo "ok stapler validate (app)"; else echo "FAIL stapler validate (app)"; fail=1; fi27INFO="$(codesign -d --verbose=4 "$APP" 2>&1)"28echo "$INFO" | grep -E "^(Identifier|TeamIdentifier|Authority=Developer ID Application|Timestamp|Runtime Version)" | sed 's/^/ /'29if echo "$INFO" | grep -q "flags=.*runtime"; then echo "ok Hardened Runtime"; else echo "FAIL Hardened Runtime flag missing"; fail=1; fi30if echo "$INFO" | grep -q "^Identifier=ai.spboucher.clustr$"; then echo "ok bundle identifier"; else echo "FAIL bundle identifier"; fail=1; fi31ENT="$(codesign -d --entitlements :- "$APP" 2>/dev/null)"32for key in com.apple.security.app-sandbox com.apple.security.network.client com.apple.developer.associated-domains keychain-access-groups com.apple.developer.aps-environment; do33 if echo "$ENT" | grep -q "<key>$key</key>"; then echo "ok entitlement $key"; else echo "FAIL entitlement $key missing"; fail=1; fi34done35if echo "$ENT" | grep -q "webcredentials:clustr.spboucher.ai"; then echo "ok webcredentials:clustr.spboucher.ai"; else echo "FAIL webcredentials domain"; fail=1; fi36if echo "$ENT" | grep -q "applinks:clustr.spboucher.ai"; then echo "ok applinks:clustr.spboucher.ai"; else echo "FAIL applinks domain"; fail=1; fi37if echo "$ENT" | grep -q "get-task-allow"; then echo "FAIL get-task-allow present"; fail=1; else echo "ok no get-task-allow"; fi38if [ -f "$APP/Contents/embedded.provisionprofile" ]; then39 PNAME="$(security cms -D -i "$APP/Contents/embedded.provisionprofile" 2>/dev/null | plutil -extract Name raw - 2>/dev/null)"40 echo "ok embedded provisioning profile: $PNAME"41else42 echo "FAIL no embedded provisioning profile (restricted entitlements would be refused at launch)"; fail=143fi44# Debug-only code (software authenticator, file-based secret store, launch overrides) must not be in the binary.45BIN="$APP/Contents/MacOS/MacLustr Command Center"46if strings "$BIN" | grep -E -q "SoftwareAuthenticator|DebugFileSecureStore|MCC_PASSKEY|MCC_SETUP_TOKEN"; then47 echo "FAIL Debug-only symbols found in the Release binary"; fail=148else49 echo "ok no Debug-only code in the binary"50fi51if plutil -extract NSAppTransportSecurity xml1 -o - "$APP/Contents/Info.plist" >/dev/null 2>&1; then echo "FAIL ATS exception in the Release Info.plist"; fail=1; else echo "ok no ATS exception"; fi52exit $fail53