Repository Public
1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/verify-release.sh4# Description: Checks the signed macOS application and its AutoFill extension: signatures, hardened runtime, sandbox,5# the entitlements actually present (printed in full), embedded profiles, extension point and declared6# capabilities, no web engine, no debug entitlement, no development switch, no secrets in the bundle.7#8# Usage: Scripts/verify-release.sh [path/to/SP Vault.app] (exit code ≠ 0 when a check fails)9set -uo pipefail10cd "$(dirname "$0")/.."11APP="${1:-dist/SP Vault.app}"; BIN="$APP/Contents/MacOS/SP Vault"; EXT="$APP/Contents/PlugIns/SPVaultAutoFill.appex"; EXTBIN="$EXT/Contents/MacOS/SPVaultAutoFill"; FAIL=012T=3YM54G49SN13ok() { echo " ✓ $1"; }; ko() { echo " ✗ $1"; FAIL=1; }14[[ -d "$APP" ]] || { echo "ERROR: $APP not found (run Scripts/release-mac.sh)" >&2; exit 1; }15echo "== codesign --verify --deep --strict --verbose=2"16codesign --verify --deep --strict --verbose=2 "$APP" 2>&1 | sed 's/^/ /' ; [[ ${PIPESTATUS[0]} -eq 0 ]] || FAIL=117for target in "$APP" "$EXT"; do18 echo "== Signature: $(basename "$target")"19 [[ -d "$target" ]] || { ko "missing"; continue; }20 codesign --verify --deep --strict "$target" 2>/dev/null && ok "codesign --verify --deep --strict" || ko "signature invalid"21 INFO="$(codesign -dvv "$target" 2>&1)"22 grep -q "Authority=Developer ID Application" <<<"$INFO" && ok "$(grep -m1 '^Authority=' <<<"$INFO")" || ko "not signed with Developer ID Application"23 grep -q "^TeamIdentifier=$T$" <<<"$INFO" && ok "TeamIdentifier=$T" || ko "unexpected team: $(grep -m1 '^TeamIdentifier=' <<<"$INFO")"24 grep -Eq "flags=.*runtime" <<<"$INFO" && ok "hardened runtime enabled" || ko "hardened runtime missing"25 grep -q "^Timestamp=" <<<"$INFO" && ok "secure timestamp present" || ko "no secure timestamp"26 grep -Eq "^Identifier=ai\.spboucher\.spvault(\.autofill)?$" <<<"$INFO" && ok "$(grep -m1 '^Identifier=' <<<"$INFO")" || ko "unexpected identifier: $(grep -m1 '^Identifier=' <<<"$INFO")"27 echo " designated requirement: $(codesign -d -r- "$target" 2>&1 | sed -n 's/^designated => //p')"28 ENT="$(codesign -d --entitlements :- "$target" 2>/dev/null)"29 echo " entitlements:"; plutil -p - <<<"$ENT" 2>/dev/null | sed 's/^/ /'30 grep -A1 "com.apple.security.app-sandbox" <<<"$ENT" | grep -q "<true/>" && ok "App Sandbox on" || ko "App Sandbox off"31 grep -q "$T.ai.spboucher.spvault</string>" <<<"$ENT" && ok "app group $T.ai.spboucher.spvault" || ko "app group missing"32 grep -q "$T.ai.spboucher.spvault.shared" <<<"$ENT" && ok "shared keychain group" || ko "shared keychain group missing"33 grep -A1 "com.apple.developer.authentication-services.autofill-credential-provider" <<<"$ENT" | grep -q "<true/>" && ok "AutoFill credential provider entitlement" || ko "AutoFill credential provider entitlement missing"34 grep -q "get-task-allow" <<<"$ENT" && ko "get-task-allow present (debug entitlement)" || ok "no get-task-allow"35 BAD=036 for 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.cs.allow-dyld-environment-variables com.apple.security.network.server com.apple.security.files.all com.apple.security.temporary-exception; do37 grep -q "$bad" <<<"$ENT" && { ko "unexpected entitlement $bad"; BAD=1; }; done38 [[ $BAD -eq 0 ]] && ok "no runtime exception, no server socket, no broad file access"39 [[ -f "$target/Contents/embedded.provisionprofile" ]] && ok "provisioning profile embedded" || ko "embedded.provisionprofile missing"40done41echo "== Application"42ENT="$(codesign -d --entitlements :- "$APP" 2>/dev/null)"43grep -q "webcredentials:vault.spboucher.ai" <<<"$ENT" && ok "associated domain webcredentials:vault.spboucher.ai (passkeys)" || ko "associated domain missing (the system passkey sheet would fail)"44grep -A1 "com.apple.security.network.client" <<<"$ENT" | grep -q "<true/>" && ok "network client" || ko "network client entitlement missing"45grep -q "$T.ai.spboucher.spvault</string>" <<<"$(grep -A1 'com.apple.application-identifier' <<<"$ENT")" && ok "application identifier $T.ai.spboucher.spvault" || ko "application identifier missing"46echo "== AutoFill extension"47EXTENT="$(codesign -d --entitlements :- "$EXT" 2>/dev/null)"48grep -q "com.apple.security.network" <<<"$EXTENT" && ko "the extension has a network entitlement (it must stay offline)" || ok "no network entitlement: the extension cannot reach the network"49[[ "$(/usr/libexec/PlistBuddy -c 'Print :NSExtension:NSExtensionPointIdentifier' "$EXT/Contents/Info.plist" 2>/dev/null)" == "com.apple.authentication-services-credential-provider-ui" ]] && ok "extension point com.apple.authentication-services-credential-provider-ui" || ko "wrong extension point"50for cap in ProvidesPasswords ProvidesPasskeys ProvidesOneTimeCodes; do51 [[ "$(/usr/libexec/PlistBuddy -c "Print :NSExtension:NSExtensionAttributes:ASCredentialProviderExtensionCapabilities:$cap" "$EXT/Contents/Info.plist" 2>/dev/null)" == "true" ]] && ok "capability $cap" || ko "capability $cap not declared"52done53echo "== Native only"54LIBS="$(for b in "$BIN" "$EXTBIN"; do for a in $(lipo -archs "$b"); do otool -arch "$a" -L "$b"; done; done; find "$APP/Contents" -name '*.dylib' -o -name '*.framework')"55grep -Eiq "WebKit|JavaScriptCore|Electron|Chromium" <<<"$LIBS" && ko "a web engine is linked" || ok "no WebKit / JavaScriptCore / Chromium linked"56find "$APP" \( -name '*.html' -o -name '*.js' -o -name '*.css' \) | grep -q . && ko "web resources in the bundle" || ok "no HTML / JS / CSS resources"57echo "== Release, not development"58for b in "$BIN" "$EXTBIN"; do59 strings -a "$b" | grep -Eq "SPV_DEV_|dev-passkeys|dev-device-keys|SPVaultDev|localhost:878[0-9]|spvault\.dev" && ko "development switch or test server in $(basename "$b")" || ok "$(basename "$b"): no SPV_DEV switch, no test server, no .dev identifier"60done61plutil -p "$APP/Contents/Info.plist" | grep -q "NSAllowsLocalNetworking" && ko "plain-HTTP exception present" || ok "no App Transport Security exception"62echo "== Secrets"63if grep -rlaE "(sk-ant-|sk-proj-|BEGIN (EC |RSA )?PRIVATE KEY|Bearer [A-Za-z0-9_-]{40})" "$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"; fi64echo "== Bundle"65echo " 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") / ext $(lipo -archs "$EXTBIN") · min macOS $(/usr/libexec/PlistBuddy -c 'Print :LSMinimumSystemVersion' "$APP/Contents/Info.plist")"66[[ -f "$APP/Contents/Resources/AppIcon.icns" || -f "$APP/Contents/Resources/Assets.car" ]] && ok "icon assets present" || ko "icon missing"67echo "== Gatekeeper (informative)"68echo " spctl -a -vv: $(spctl -a -vv "$APP" 2>&1 | tr '\n' ' ')"69echo " note: 'rejected … Unnotarized Developer ID' is EXPECTED until Scripts/notarize.sh has stapled a ticket; it is not counted as a failure here."70exit $FAIL71