Skip to content

Commit 3c551cc

Browse files
cameroncookeclaude
andcommitted
fix(packaging): Skip spctl for ad-hoc AXe signatures
Portable packaging now ad-hoc signs bundled AXe assets for runtime compatibility.\nGatekeeper (spctl) rejects ad-hoc signatures by design, which caused the\npackaging step to fail despite valid runtime behavior.\n\nSkip spctl only when the AXe binary is ad-hoc signed, while keeping strict\ncodesign verification and runtime execution checks in place. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4db5e1f commit 3c551cc

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

scripts/package-macos-portable.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ verify_axe_assets() {
116116
done < <(find "$frameworks_dir" -name "*.framework" -type d)
117117

118118
if codesign -dv "$axe_bin" >/dev/null 2>&1; then
119+
local codesign_details
120+
codesign_details="$(codesign -dv "$axe_bin" 2>&1 || true)"
121+
local is_ad_hoc_signature=false
122+
if grep -qi "Signature=adhoc" <<<"$codesign_details"; then
123+
is_ad_hoc_signature=true
124+
fi
125+
119126
codesign --verify --deep --strict "$axe_bin"
120127
while IFS= read -r framework_path; do
121128
framework_name="$(basename "$framework_path" .framework)"
@@ -126,17 +133,21 @@ verify_axe_assets() {
126133
codesign --verify --deep --strict "$framework_binary"
127134
done < <(find "$frameworks_dir" -name "*.framework" -type d)
128135

129-
spctl_log="$(mktemp)"
130-
if ! spctl --assess --type execute "$axe_bin" 2>"$spctl_log"; then
131-
if grep -q "does not seem to be an app" "$spctl_log"; then
132-
echo "Gatekeeper execute assessment is inconclusive for CLI binaries; continuing"
133-
else
134-
cat "$spctl_log"
135-
rm "$spctl_log"
136-
exit 1
136+
if [[ "$is_ad_hoc_signature" == "true" ]]; then
137+
echo "AXe binary uses ad-hoc signing; skipping Gatekeeper assessment"
138+
else
139+
spctl_log="$(mktemp)"
140+
if ! spctl --assess --type execute "$axe_bin" 2>"$spctl_log"; then
141+
if grep -q "does not seem to be an app" "$spctl_log"; then
142+
echo "Gatekeeper execute assessment is inconclusive for CLI binaries; continuing"
143+
else
144+
cat "$spctl_log"
145+
rm "$spctl_log"
146+
exit 1
147+
fi
137148
fi
149+
rm "$spctl_log"
138150
fi
139-
rm "$spctl_log"
140151
else
141152
echo "AXe binary is unsigned; skipping codesign and Gatekeeper verification"
142153
fi

0 commit comments

Comments
 (0)