mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 02:29:55 +02:00
fix(release): enforce Apple hardened runtime
This commit is contained in:
42
apple/scripts/sign-exported-app.sh
Executable file
42
apple/scripts/sign-exported-app.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 3 ]]; then
|
||||
printf 'Usage: %s <app-bundle> <signing-identity> <entitlements>\n' "$0" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
app=$1
|
||||
signing_identity=$2
|
||||
entitlements=$3
|
||||
|
||||
[[ -d $app ]] || {
|
||||
printf 'error: exported app bundle does not exist: %s\n' "$app" >&2
|
||||
exit 1
|
||||
}
|
||||
[[ -n $signing_identity ]] || {
|
||||
printf 'error: signing identity is empty\n' >&2
|
||||
exit 1
|
||||
}
|
||||
[[ -f $entitlements ]] || {
|
||||
printf 'error: entitlements file does not exist: %s\n' "$entitlements" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
codesign \
|
||||
--force \
|
||||
--sign "$signing_identity" \
|
||||
--options runtime \
|
||||
--timestamp \
|
||||
--entitlements "$entitlements" \
|
||||
"$app"
|
||||
codesign --verify --deep --strict --verbose=2 "$app"
|
||||
|
||||
signature_details="$(codesign --display --verbose=4 "$app" 2>&1)"
|
||||
printf '%s\n' "$signature_details"
|
||||
printf '%s\n' "$signature_details" |
|
||||
grep -Eq 'flags=.*\(runtime([^)]*)?\)' || {
|
||||
printf 'error: exported app signature does not enable the hardened runtime\n' >&2
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user