提交记录修改scripts/verify-macos-release.sh+13 −2看文件
| @@ -2,6 +2,17 @@ | ||
| 2 | 2 | # Validate the actual downloaded distribution without installing or launching it. |
| 3 | 3 | set -euo pipefail |
| 4 | 4 | directory="${1:?Usage: scripts/verify-macos-release.sh <release-directory>}" |
| 5 | 新增:# stapler contacts Apple's CloudKit even for a stapled artifact. Hosted runners | |
| 6 | 新增:# can lose this connection; retry service failures without bypassing validation. | |
| 7 | 新增:validate_ticket() { | |
| 8 | 新增: local attempt status | |
| 9 | 新增: for attempt in 1 2 3; do | |
| 10 | 新增: if xcrun stapler validate "$1"; then return 0; else status=$?; fi | |
| 11 | 新增: if [[ "$status" != 68 || "$attempt" == 3 ]]; then return "$status"; fi | |
| 12 | 新增: echo "Apple ticket service unavailable; retry $attempt/2." >&2 | |
| 13 | 新增: sleep 5 | |
| 14 | 新增: done | |
| 15 | 新增:} | |
| 5 | 16 | shopt -s nullglob |
| 6 | 17 | archives=("$directory"/Cage-*-macos-arm64.dmg) |
| 7 | 18 | if [[ ${#archives[@]} != 1 ]]; then echo 'Expected exactly one Cage DMG.' >&2; exit 1; fi |
| @@ -10,7 +21,7 @@ version="${archive##*/Cage-}" | ||
| 10 | 21 | version="${version%-macos-arm64.dmg}" |
| 11 | 22 | (cd "$directory" && shasum -a 256 --check SHA256SUMS) |
| 12 | 23 | codesign --verify --strict --verbose=2 "$archive" |
| 13 | 删除:xcrun stapler validate "$archive" | |
| 24 | 新增:validate_ticket "$archive" | |
| 14 | 25 | spctl --assess --type open --context context:primary-signature --verbose=2 "$archive" |
| 15 | 26 | mount="$(mktemp -d)" |
| 16 | 27 | cleanup() { hdiutil detach "$mount" >/dev/null 2>&1 || true; rmdir "$mount" 2>/dev/null || true; } |
| @@ -20,6 +31,6 @@ bundle="$mount/Cage.app" | ||
| 20 | 31 | test "$(/usr/libexec/PlistBuddy -c 'Print :CageVersion' "$bundle/Contents/Info.plist")" = "$version" |
| 21 | 32 | codesign --verify --deep --strict --verbose=2 \ |
| 22 | 33 | -R='anchor apple generic and identifier "io.github.lee-xeo.claude-cage" and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists' "$bundle" |
| 23 | 删除:xcrun stapler validate "$bundle" | |
| 34 | 新增:validate_ticket "$bundle" | |
| 24 | 35 | spctl --assess --type execute --verbose=2 "$bundle" |
| 25 | 36 | echo "Verified Developer ID, notarization, Gatekeeper, and version: Cage $version" |

