The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(mobile): sign entitlements onto the iOS release archive (#3320)
tony496s294530031746
diff --git a/mobile/RELEASE.md b/mobile/RELEASE.mdindex 7788c9f82..be478fb45 100644--- a/mobile/RELEASE.md+++ b/mobile/RELEASE.md@@ -148,9 +148,13 @@ may lack symbolicated stacks until the matching symbols are supplied.| `1.0.12 (77)` | 2026-11-02 | TestFlight. Start opens the new computer's harness, with a keep-on warning while updating and a bar while an agent installs; in Swarm, the floating chat composer, invitations, task steps and chat files up to 256 MB. Built from `feat/mobile-ios-android` at `78c63a84` || `1.0.12 (78)` | 2026-11-02 | TestFlight. In Swarm only, nothing else in `mobile/lib` changed since 77: the Buddy tab opens your one Swarm Buddy chat, Home's Sort by and Filter menu and always-on While you were away, a long press on a machine opens its menu. Built from `feat/mobile-ios-android` at `2c6939e6` || `1.0.12 (79)` | 2026-11-03 | TestFlight. In Swarm only, nothing else in `mobile/lib` changed since 78: invitations on Home with Join and Not now, Older chats from Home, a project's number counts only its own chat, the Buddy picker says when a machine is paused. Built from `feat/mobile-ios-android` at `e8620dbe` |-| `1.0.12 (80)` | 2026-11-03 | TestFlight. The iPhone joins the Intern 3 setup hotspot itself, and Set up Intern 3 reads a computer whose key is not logged yet as connecting, with a bar, on a slow Wi-Fi; in Swarm, the Slack-style Home and chat, Markdown in messages, route rows, terminal notes and proposals drawn as on Desktop, drafts and Not sent kept per account, search, and writes sent with the phone's own sign-in. Built from `feat/mobile-ios-android` at `7814f059` |+| `1.0.12 (80)` | 2026-11-03 | TestFlight. The iPhone joins the Intern 3 setup hotspot itself, and Set up Intern 3 reads a computer whose key is not logged yet as connecting, with a bar, on a slow Wi-Fi; in Swarm, the Slack-style Home and chat, Markdown in messages, route rows, terminal notes and proposals drawn as on Desktop, drafts and Not sent kept per account, search, and writes sent with the phone's own sign-in. Signed without its entitlements (see 83), so this build cannot join the setup hotspot itself. Built from `feat/mobile-ios-android` at `7814f059` |+| `1.0.12 (81)` | 2026-11-04 | TestFlight. Set up Intern 3 tries the hotspot again, checks the Wi-Fi, falls back to Settings, keeps Wi-Fi passwords and says when a setup failed; a stopped agent can be resumed; in Swarm, voice messages, editing and deleting your own message, Mark unread and Remind me, link previews, adding and removing agents, project sharing and settings, and the System, Dark or Light theme. Signed without its entitlements, like 80. Built from `feat/mobile-ios-android` at `4aa17808` |+| `1.0.12 (82)` | 2026-11-05 | TestFlight. Push notifications (APNs) and fewer repeated question notices. Signed without its entitlements, so it has no push and no setup hotspot: use 83. Built from `feat/mobile-ios-android` at `0c47f4f8` |+| `1.0.12 (83)` | 2026-11-05 | TestFlight. The same code as 82, the first build signed with its entitlements: `aps-environment` (production) and the setup hotspot. 80 to 82 went up without them because the archive is unsigned and the export signs only what the app carries; `release-ios.sh` now signs them onto the archived app and checks the exported app before it uploads. Built from `feat/mobile-ios-android` at `0c47f4f8` |+| `1.0.12 (84)` | 2026-11-06 | TestFlight, uploaded from another Mac with `--build-number=84` (#3303). Whether it carries its entitlements was not checked. Built from `main` at `b8b8c8ea` |-`pubspec.yaml` is now at `1.0.12+81`, the next build number. Build 80 (1.0.12) is the last TestFlight build and+`pubspec.yaml` is at `1.0.12+85` with #3303, the next build number. Build 84 (1.0.12) is the last TestFlight build and79 the last Play build (54 went up outside this record, 53 went to Play only); do not upload any of them again. 1.0.1 to 1.0.10 are approved and 1.0.11 is submitted or approved, so new builds go up as 1.0.12 until it is submitted or approved too. Check App Store Connect before uploading if another release has happened meanwhile.### Why the app is iPhone-onlydiff --git a/mobile/scripts/ios-entitlements.sh b/mobile/scripts/ios-entitlements.shnew file mode 100644index 000000000..d2e7668b4--- /dev/null+++ b/mobile/scripts/ios-entitlements.sh@@ -0,0 +1,46 @@+# Entitlements on the iOS release build. Sourced by release-ios.sh; tested by+# test-ios-entitlements.sh (`bash mobile/scripts/test-ios-entitlements.sh`).+#+# The release archive is UNSIGNED (release-ios.sh says why), so its app carries no entitlements, and+# the export then signs it with only what the binary asks for. TestFlight 1.0.12 (80) to (82) went up+# like that: without the setup hotspot (`com.apple.developer.networking.HotspotConfiguration`) and+# without push (`aps-environment`), both of which fail on the phone without saying why. An ad-hoc+# signature, which needs no certificate, puts the entitlements on the app, and the export carries+# them over (aps-environment becomes production there).++# The top-level keys of what `plutil -p` printed: theirs are the lines indented by two spaces.+plist_keys() {+ sed -n 's/^ "\([^"]*\)" => .*/\1/p'+}++# carry_entitlements <.app> <entitlements plist>+carry_entitlements() {+ codesign --force --sign - --timestamp=none --generate-entitlement-der --entitlements "$2" "$1"+}++# check_entitlements <.app> <what it is> <any|production> <entitlements plist>+#+# Fails, naming them, when the app's signature lacks a key the plist asks for. With `production`, it+# also fails when the app's aps-environment is not production: its pushes would go to the APNs+# sandbox, which a TestFlight or App Store install never hears from.+check_entitlements() {+ local have key missing=""+ if [[ ! -f "$4" ]]; then+ echo "!! no entitlements file at $4" >&2+ return 1+ fi+ have="$(codesign -d --entitlements - --xml "$1" 2>/dev/null | plutil -p - 2>/dev/null || true)"+ for key in $(plutil -p "$4" | plist_keys); do+ printf '%s\n' "$have" | grep -q "^ \"$key\" => " || missing="$missing $key"+ done+ if [[ -n "$missing" ]]; then+ echo "!! $2 is signed without:$missing (asked for in $(basename "$4"))" >&2+ return 1+ fi+ if [[ "$3" == production ]] && printf '%s\n' "$have" | grep -q '^ "aps-environment" => ' &&+ ! printf '%s\n' "$have" | grep -q '^ "aps-environment" => "production"$'; then+ echo "!! $2 has a development aps-environment: its pushes would go to the APNs sandbox" >&2+ return 1+ fi+ echo " $2 carries $(printf '%s\n' "$have" | plist_keys | tr '\n' ' ')"+}diff --git a/mobile/scripts/release-ios.sh b/mobile/scripts/release-ios.shindex 222378542..a36901f79 100755--- a/mobile/scripts/release-ios.sh+++ b/mobile/scripts/release-ios.sh@@ -40,6 +40,8 @@ set -euo pipefailROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # mobile/cd "$ROOT"+# shellcheck source=ios-entitlements.sh+source "$ROOT/scripts/ios-entitlements.sh"VALIDATE_ONLY=0SKIP_BUILD=0@@ -69,6 +71,10 @@ if [[ -z "$TEAM_ID" ]]; thenexit 1fi+# What the app asks for (push, the setup hotspot), read from the project too. Empty: none.+ENTITLEMENTS="$(sed -n 's/.*CODE_SIGN_ENTITLEMENTS = \(.*\);.*/\1/p' ios/Runner.xcodeproj/project.pbxproj | head -1)"+ENTITLEMENTS="${ENTITLEMENTS:+ios/$ENTITLEMENTS}"+# -- credentials, before spending five minutes on a build ----------------------------------------# They live OUTSIDE this repo, which is PUBLIC. A Key ID and an Issuer ID are not secrets on their# own, but they are exactly the two halves a stray .p8 would need, and the repo's own .gitignore@@ -143,6 +149,22 @@ EOF-allowProvisioningUpdates ${XCODE_AUTH[@]+"${XCODE_AUTH[@]}"}}+# The entitlements onto the archived app, for the export to carry (ios-entitlements.sh says why).+sign_archive_entitlements() {+ [[ -n "$ENTITLEMENTS" ]] || return 0+ echo "==> entitlements onto the archived app (ad-hoc signature)"+ carry_entitlements "$ARCHIVE/Products/Applications/Runner.app" "$ENTITLEMENTS"+ check_entitlements "$ARCHIVE/Products/Applications/Runner.app" "the archived app" any "$ENTITLEMENTS"+}++# The app inside the exported ipa, unpacked so its signature can be read, before anything goes up.+check_ipa_entitlements() { # $1 = .ipa+ [[ -n "$ENTITLEMENTS" ]] || return 0+ rm -rf "$WORK/ipa" && mkdir -p "$WORK/ipa" && unzip -q "$1" -d "$WORK/ipa"+ check_entitlements "$(ls -d "$WORK"/ipa/Payload/*.app | head -1)" "the exported app" production \+ "$ENTITLEMENTS"+}+# The pair printed above came from pubspec.yaml, which is what the NEXT build would carry — with# --skip-build the artifact on disk can predate a bump, and then the number announced is not the# number sent. Ask the artifact itself and say so.@@ -178,8 +200,9 @@ EOF# The archive is left UNSIGNED and the export signs it, app and frameworks alike, with the team's# Apple Distribution certificate. A signed archive would need an Apple Development certificate on# this Mac first, and the shared release account has used up its quota of those ("Choose a-# certificate to revoke") — revoking one breaks whichever Mac holds it. Runner has no entitlements-# file, so the export's own (application-identifier, team, beta-reports-active) are all it needs.+# certificate to revoke") — revoking one breaks whichever Mac holds it. An unsigned app carries no+# entitlements, though, so Runner.entitlements goes onto it with an ad-hoc signature first, and the+# exported app is checked for them before it is uploaded (ios-entitlements.sh).if [[ "$SKIP_BUILD" == 0 ]]; thenecho "==> flutter build ios --config-only"flutter build ios --release --config-only@@ -189,6 +212,7 @@ if [[ "$SKIP_BUILD" == 0 ]]; then-sdk iphoneos -destination generic/platform=iOS -archivePath "$ARCHIVE" \-quiet archive COMPILER_INDEX_STORE_ENABLE=NO \CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=""+ sign_archive_entitlementsif [[ "$UPLOAD_WITH_XCODE" == 0 ]]; thenecho "==> xcodebuild -exportArchive"@@ -206,6 +230,16 @@ if [[ "$UPLOAD_WITH_XCODE" == 1 ]]; thenwarn_if_stale \"$(plutil -extract ApplicationProperties.CFBundleShortVersionString raw -o - "$ARCHIVE/Info.plist" 2>/dev/null || true)" \"$(plutil -extract ApplicationProperties.CFBundleVersion raw -o - "$ARCHIVE/Info.plist" 2>/dev/null || true)"+ # An archive left by a run from before the ad-hoc step has none on it yet.+ if [[ "$SKIP_BUILD" == 1 ]]; then+ sign_archive_entitlements+ fi++ # The upload signs the archive the way this export does, and leaves nothing on disk to look at:+ # export it here first, so the app that goes up has been checked.+ echo "==> xcodebuild -exportArchive, to check what the upload will sign"+ export_archive export+ check_ipa_entitlements "$(ls -t "$IPA_DIR"/*.ipa | head -1)"echo "==> uploading with Xcode's account"export_archive upload@@ -226,6 +260,7 @@ ipa_key() {| plutil -extract "$1" raw -o - - 2>/dev/null || true}warn_if_stale "$(ipa_key CFBundleShortVersionString)" "$(ipa_key CFBundleVersion)"+check_ipa_entitlements "$IPA"# Validation catches the whole class of rejections that otherwise arrive by email 20 minutes later:# a duplicate build number, a missing icon size, an entitlement the profile does not grant.diff --git a/mobile/scripts/test-ios-entitlements.sh b/mobile/scripts/test-ios-entitlements.shnew file mode 100755index 000000000..8afde575d--- /dev/null+++ b/mobile/scripts/test-ios-entitlements.sh@@ -0,0 +1,102 @@+#!/usr/bin/env bash+# Tests for ios-entitlements.sh: `bash mobile/scripts/test-ios-entitlements.sh` (macOS: codesign).+#+# Each case signs a tiny .app ad hoc, as release-ios.sh signs the archived Runner.app, and checks+# what check_entitlements makes of it.+set -euo pipefail++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+# shellcheck source=ios-entitlements.sh+source "$HERE/ios-entitlements.sh"++WORK="$(mktemp -d)"+trap 'rm -rf "$WORK"' EXIT+FAILED=0++# A bundle codesign accepts: an Info.plist and a Mach-O main executable.+make_app() { # $1 = name; prints the .app path+ local app="$WORK/$1.app"+ mkdir -p "$app"+ cp /usr/bin/true "$app/Runner"+ cat > "$app/Info.plist" <<EOF+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>CFBundleExecutable</key><string>Runner</string>+ <key>CFBundleIdentifier</key><string>test.entitlements.$1</string>+ <key>CFBundlePackageType</key><string>APPL</string>+</dict>+</plist>+EOF+ echo "$app"+}++make_entitlements() { # $1 = name, $2 = aps-environment value ("" leaves it out), $3 = hotspot yes|no+ local file="$WORK/$1.entitlements"+ {+ echo '<?xml version="1.0" encoding="UTF-8"?>'+ echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'+ echo '<plist version="1.0"><dict>'+ [[ -n "$2" ]] && echo "<key>aps-environment</key><string>$2</string>"+ [[ "$3" == yes ]] && echo '<key>com.apple.developer.networking.HotspotConfiguration</key><true/>'+ echo '</dict></plist>'+ } > "$file"+ echo "$file"+}++# expect <passes|fails> <name> <stderr must contain, or ""> <command...>+expect() {+ local want="$1" name="$2" needle="$3" got err+ shift 3+ if "$@" > "$WORK/out" 2> "$WORK/err"; then got=passes; else got=fails; fi+ err="$(cat "$WORK/err")"+ if [[ "$got" != "$want" ]]; then+ echo "FAIL $name: wanted it to $want, it $got. stderr: $err"+ FAILED=1+ elif [[ -n "$needle" && "$err" != *"$needle"* ]]; then+ echo "FAIL $name: stderr does not say '$needle': $err"+ FAILED=1+ else+ echo "ok $name"+ fi+}++ASKED="$(make_entitlements asked development yes)" # what Runner.entitlements asks for+STORE="$(make_entitlements store production yes)" # what the export turns it into++unsigned="$(make_app unsigned)"+expect fails "an unsigned app lacks every entitlement asked for" \+ "signed without: aps-environment com.apple.developer.networking.HotspotConfiguration" \+ check_entitlements "$unsigned" "the app" any "$ASKED"++carried="$(make_app carried)"+carry_entitlements "$carried" "$ASKED" 2> /dev/null+expect passes "an app signed ad hoc with them carries them" "" \+ check_entitlements "$carried" "the app" any "$ASKED"+expect fails "a store build with a development aps-environment is refused" \+ "development aps-environment" \+ check_entitlements "$carried" "the app" production "$ASKED"++store="$(make_app store)"+carry_entitlements "$store" "$STORE" 2> /dev/null+expect passes "a store build with a production aps-environment passes" "" \+ check_entitlements "$store" "the app" production "$ASKED"++no_push="$(make_app no_push)"+carry_entitlements "$no_push" "$(make_entitlements hotspot_only "" yes)" 2> /dev/null+expect fails "an app without push names only that one" "signed without: aps-environment (" \+ check_entitlements "$no_push" "the app" any "$ASKED"++no_aps_asked="$(make_entitlements hotspot_asked "" yes)"+expect passes "an app that asks for no push is not held to production" "" \+ check_entitlements "$no_push" "the app" production "$no_aps_asked"++expect fails "a missing entitlements file is an error, not a pass" "no entitlements file" \+ check_entitlements "$carried" "the app" any "$WORK/nowhere.entitlements"++if [[ "$FAILED" == 0 ]]; then+ echo "all passed"+else+ exit 1+fi