Repository Public
1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/verify-release.sh4# Description: Checks the signed application: signature, hardened runtime, sandbox and entitlements, embedded profile, no web engine, no debug entitlement, no secrets in the bundle.5#6# Usage: Scripts/verify-release.sh [path/to/SP Chat.app] (exit code ≠ 0 when a check fails)7set -uo pipefail8cd "$(dirname "$0")/.."9APP="${1:-dist/SP Chat.app}"; BIN="$APP/Contents/MacOS/SP Chat"; FAIL=010ok() { echo " ✓ $1"; }; ko() { echo " ✗ $1"; FAIL=1; }11[[ -d "$APP" ]] || { echo "ERROR: $APP not found" >&2; exit 1; }12echo "== Signature"13codesign --verify --deep --strict "$APP" 2>/dev/null && ok "codesign --verify --deep --strict" || ko "signature invalid"14INFO="$(codesign -dvv "$APP" 2>&1)"15grep -q "Authority=Developer ID Application" <<<"$INFO" && ok "$(grep -m1 '^Authority=' <<<"$INFO")" || ko "not signed with Developer ID Application"16grep -Eq "flags=.*runtime" <<<"$INFO" && ok "hardened runtime enabled" || ko "hardened runtime missing"17grep -q "^Timestamp=" <<<"$INFO" && ok "secure timestamp present" || ko "no secure timestamp"18echo "== Entitlements"19ENT="$(codesign -d --entitlements :- "$APP" 2>/dev/null)"20grep -A1 "com.apple.security.app-sandbox" <<<"$ENT" | grep -q "<true/>" && ok "App Sandbox on" || ko "App Sandbox off"21grep -q "webcredentials:chat.spboucher.ai" <<<"$ENT" && ok "associated domain webcredentials:chat.spboucher.ai" || ko "associated domain missing (passkeys would fail)"22grep -q "get-task-allow" <<<"$ENT" && ko "get-task-allow present (debug entitlement)" || ok "no get-task-allow"23for bad in com.apple.security.cs.disable-library-validation com.apple.security.cs.allow-unsigned-executable-memory com.apple.security.cs.allow-jit com.apple.security.network.server com.apple.security.files.downloads com.apple.security.device.camera; do24 grep -q "$bad" <<<"$ENT" && ko "unexpected entitlement $bad"; done; ok "no runtime exception, no server socket, no camera, no broad file access"25[[ -f "$APP/Contents/embedded.provisionprofile" ]] && ok "provisioning profile embedded" || ko "embedded.provisionprofile missing"26echo "== Native only"27LIBS="$(for a in $(lipo -archs "$BIN"); do otool -arch "$a" -L "$BIN"; find "$APP/Contents" -name '*.dylib' -o -name '*.framework' | while read -r f; do echo "$f"; done; done)"28grep -Eiq "WebKit|JavaScriptCore|Electron|Chromium" <<<"$LIBS" && ko "a web engine is linked" || ok "no WebKit / JavaScriptCore / Chromium linked"29find "$APP" \( -name '*.html' -o -name '*.js' -o -name '*.css' \) | grep -q . && ko "web resources in the bundle" || ok "no HTML / JS / CSS resources"30echo "== Secrets"31if grep -rlaE "(sk-ant-|sk-proj-|xai-[A-Za-z0-9]{20}|BEGIN (EC |RSA )?PRIVATE KEY|csa_session=[A-Za-z0-9_-]{43})" "$APP" >/dev/null 2>&1; then ko "something that looks like a secret is in the bundle"; else ok "no API key, private key or session token in the bundle"; fi32echo "== Bundle"33echo " version $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Contents/Info.plist")) · archs $(lipo -archs "$BIN") · min macOS $(/usr/libexec/PlistBuddy -c 'Print :LSMinimumSystemVersion' "$APP/Contents/Info.plist") · $(du -sh "$APP" | cut -f1)"34[[ -f "$APP/Contents/Resources/AppIcon.icns" || -f "$APP/Contents/Resources/Assets.car" ]] && ok "icon assets present" || ko "icon missing"35exit $FAIL36