Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Release 2.0.8 with escalator rename and bootstrap UI fixes

Lakr9d218dedf58d
diff --git a/AGENTS.md b/AGENTS.md
index 119f3908..ce5be0b5 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -8,7 +8,7 @@ Virtual iPhone boot tool using Apple's Virtualization.framework with PCC researc
- **Test:** Run the Xcode test schemes in their owning projects. The `VPhone` build validates the finished bundle.
- **Boot (GUI):** `vphone-cli vm launch <name>`
- **Boot (DFU):** `vphone-cli vm launch <name> --dfu`
-- **AMFI refuses `vphone-vm`?** Launchpad uses its SMJobBless helper to run the installed bundle's `VPhoneEscalator` after checking its receipt. Standalone CLI users can run the allowlist tool as shown in `Documents/Guides/host-setup.md`. Repeat after the VM cdhash changes.
+- **AMFI refuses `vphone-vm`?** Launchpad uses its SMJobBless helper to run the installed bundle's `vphone-escalator` after checking its receipt. Standalone CLI users can run the allowlist tool as shown in `Documents/Guides/host-setup.md`. Repeat after the VM cdhash changes.
- **Restore:** `vphone-cli restore` runs in process over the vendored recovery and restore C modules in `VPhoneExecutable/VPhoneCommand/VPhoneRestore`.
- **Platform:** macOS 15+ (Sequoia). `vphone-vm` needs amfid to accept its private entitlements: either SIP off with `amfi_get_out_of_my_way=1`, or SIP on (`--without debug`) plus an allowlist bypass. Both are in `Documents/Guides/host-setup.md`. Launchpad's bundle preflight checks SIP and Research Guests and applies the allowlist through its installed helper.
- **Language:** Swift 6.0 in handwritten Xcode projects, private APIs via [Dynamic](https://github.com/mhdhejazi/Dynamic).
@@ -55,8 +55,8 @@ The `VPhone` scheme puts host programs in `VPhone.bundle/Contents/MacOS` and eve
### Key Patterns
- `vphone-cli` is the unentitled entry point. `VPhoneGuestLaunchPlanner` resolves `vphone-vm` beside the running executable, checks its entitlements, probes AMFI, and reports the exact allowlist command on refusal. It never obtains root itself.
-- `VPhoneEscalator` manages AMFI cdhash admission only. It writes amfid heap state, not executable code. Root authorization belongs to the user or to `vphone-launchpad`; neither `vphone-cli` nor the bundle has an SMJobBless or sudo password flow.
-- `vphone-launchpad` has no entitlements. It asks for Developer Tools access (`EPDeveloperTool`) and adds an `EPExecutionPolicy` exception for each installed bundle. Its helper is the only root surface: it installs verified releases into the root-owned store `/Library/Application Support/vphone-launchpad/Bundles`, runs that bundle's `VPhoneEscalator allow` for its receipt-pinned `vphone-vm`, and runs `cfw install` from that store after rechecking the recorded cdhash. There is no generic command verb. Nothing is signed at build time: `VPhoneLaunchpad/Build/SignLaunchpad.sh` signs afterwards, and the team comes from the gitignored `Configuration/Developer.xcconfig`. Never commit a team ID.
+- `vphone-escalator` manages AMFI cdhash admission only. It writes amfid heap state, not executable code. Root authorization belongs to the user or to `vphone-launchpad`; neither `vphone-cli` nor the bundle has an SMJobBless or sudo password flow.
+- `vphone-launchpad` has no entitlements. It asks for Developer Tools access (`EPDeveloperTool`) and adds an `EPExecutionPolicy` exception for each installed bundle. Its helper is the only root surface: it installs verified releases into the root-owned store `/Library/Application Support/vphone-launchpad/Bundles`, runs that bundle's `vphone-escalator allow` for its receipt-pinned `vphone-vm`, and runs `cfw install` from that store after rechecking the recorded cdhash. There is no generic command verb. Nothing is signed at build time: `VPhoneLaunchpad/Build/SignLaunchpad.sh` signs afterwards, and the team comes from the gitignored `Configuration/Developer.xcconfig`. Never commit a team ID.
- Host VM artifacts, caches, and archives created by vphone use mode `0777` for workstation access. Symlinks are not followed when changing permissions. Guest filesystem modes inside `Disk.img` remain unchanged.
- `VPhoneRestore` runs in the CLI process over vendored libirecovery and idevicerestore. No Python or runtime Homebrew dependency is allowed.
- The VM process owns AppKit windows and the guest control connection. `vphoned` serves HTTP and WebSocket over VSOCK 1339, with camera data on 1338.
diff --git a/Documents/Guides/bundle-integration.md b/Documents/Guides/bundle-integration.md
index e272c2fc..95d69493 100644
--- a/Documents/Guides/bundle-integration.md
+++ b/Documents/Guides/bundle-integration.md
@@ -10,7 +10,7 @@ executables and resources, not a macOS app or a dynamically loaded plug-in.
| --- | --- |
| `Contents/MacOS/vphone-cli` | Unentitled command entry point |
| `Contents/MacOS/vphone-vm` | VM and window process; private virtualization entitlements |
-| `Contents/MacOS/VPhoneEscalator` | AMFI allowlist tool for the current VM cdhash |
+| `Contents/MacOS/vphone-escalator` | AMFI allowlist tool for the current VM cdhash |
| `Contents/MacOS/libswiftCompatibilitySpan.vphone.dylib` | Swift back-deployment library for `vphone-vm` on macOS 15 |
| `Contents/Resources/guest-resources/vphoned` | Pre-signed guest daemon with its own entitlements; the bundle contains no unsigned copy |
| `Contents/Resources/guest-resources/*.dylib` | Guest libraries: launchd hook, SystemHook, camera hooks and the GPU compiler plugin |
@@ -20,6 +20,8 @@ executables and resources, not a macOS app or a dynamically loaded plug-in.
`Contents/MacOS` holds only programs that run on the Mac.
`guest-resources` holds only files installed into the guest; every Mach-O in
it is built for iOS. `ValidateBundle.sh` enforces both rules.
+Launchpad 2.0.8 requires a bundle version of at least 2.0.8 and the
+`vphone-escalator` executable. It does not load older bundle layouts.
All executable payloads use ad hoc code signatures. Only the required child
processes carry private entitlements. The bundle has no `CFBundleExecutable`,
diff --git a/Documents/Guides/host-setup.md b/Documents/Guides/host-setup.md
index 71dbb775..e6ca38ee 100644
--- a/Documents/Guides/host-setup.md
+++ b/Documents/Guides/host-setup.md
@@ -51,16 +51,16 @@ After rebooting, allowlist the **current signed build**. In a source checkout:
```sh
bundle=.build/XcodeBundle/Build/Products/Debug/VPhone.bundle
-sudo "$bundle/Contents/MacOS/VPhoneEscalator" allow "$bundle/Contents/MacOS/vphone-vm"
-"$bundle/Contents/MacOS/VPhoneEscalator" status
+sudo "$bundle/Contents/MacOS/vphone-escalator" allow "$bundle/Contents/MacOS/vphone-vm"
+"$bundle/Contents/MacOS/vphone-escalator" status
"$bundle/Contents/MacOS/vphone-cli" host preflight
```
-The helper creates the AMFI code-requirements preference if absent. If it exists, it appends the current `vphone-vm` cdhash to its `Entitlements` requirement, preserving other cdhashes and preference keys. It leaves any existing `AllowUnsafeDynamicLinking` value untouched and writes `false` only when that key is absent. It avoids duplicate hashes and enables amfid to consult the requirement by changing one byte in its heap. **Repeat the `allow` command after every build**, including a rebuild that only changes the signature. You may pass additional signed host binaries to the same `allow` command when they need restricted entitlements; the unentitled `vphone-cli` does not need this. `sudo "$bundle/Contents/MacOS/VPhoneEscalator" off` removes only hashes added by this helper and restarts amfid. It preserves the preference and its other values.
+The helper creates the AMFI code-requirements preference if absent. If it exists, it appends the current `vphone-vm` cdhash to its `Entitlements` requirement, preserving other cdhashes and preference keys. It leaves any existing `AllowUnsafeDynamicLinking` value untouched and writes `false` only when that key is absent. It avoids duplicate hashes and enables amfid to consult the requirement by changing one byte in its heap. **Repeat the `allow` command after every build**, including a rebuild that only changes the signature. You may pass additional signed host binaries to the same `allow` command when they need restricted entitlements; the unentitled `vphone-cli` does not need this. `sudo "$bundle/Contents/MacOS/vphone-escalator" off` removes only hashes added by this helper and restarts amfid. It preserves the preference and its other values.
-For a distributed bundle without a source checkout, run `vphone-cli host preflight` first. If AMFI refuses the guest, its error gives the full `sudo .../VPhoneEscalator allow .../vphone-vm` command for that bundle.
+For a distributed bundle without a source checkout, run `vphone-cli host preflight` first. If AMFI refuses the guest, its error gives the full `sudo .../vphone-escalator allow .../vphone-vm` command for that bundle.
-In `vphone-launchpad`, bundle preflight checks that SIP debugging restrictions are disabled (or SIP is fully disabled) and Research Guests is enabled. When a newer app includes a newer SMJobBless helper, Launchpad asks for administrator authorization to update the helper at startup. If the installed `vphone-vm` is blocked by AMFI, the helper checks those host settings again, verifies the root-owned bundle and its recorded cdhash, runs that bundle's `VPhoneEscalator allow` as root, and Launchpad repeats preflight. Each new bundle signature is checked and allowed separately. The standalone CLI still reports the manual command.
+In `vphone-launchpad`, bundle preflight checks that SIP debugging restrictions are disabled (or SIP is fully disabled) and Research Guests is enabled. When a newer app includes a newer SMJobBless helper, Launchpad asks for administrator authorization to update the helper at startup. If the installed `vphone-vm` is blocked by AMFI, the helper checks those host settings again, verifies the root-owned bundle and its recorded cdhash, runs that bundle's `vphone-escalator allow` as root, and Launchpad repeats preflight. Each new bundle signature is checked and allowed separately. The standalone CLI still reports the manual command.
## What the build contains
diff --git a/Documents/README_ja.md b/Documents/README_ja.md
index 7be38aaf..22835bdd 100644
--- a/Documents/README_ja.md
+++ b/Documents/README_ja.md
@@ -14,7 +14,7 @@ Apple Silicon Mac 上で仮想 iPhone を作成・実行します。vphone-cli
## はじめに
-macOS 15 以降を搭載した物理 Apple Silicon Mac では、公証済みの [vphone-launchpad 2.0.6](https://github.com/Lakr233/vphone-cli/releases/download/2.0.6/vphone-launchpad-2.0.6-notarized.zip) を使用してください。リリース版の実行に Xcode、Python、Homebrew は不要です。
+macOS 15 以降を搭載した物理 Apple Silicon Mac では、公証済みの [vphone-launchpad 2.0.8](https://github.com/Lakr233/vphone-cli/releases/download/2.0.8/vphone-launchpad-2.0.8-notarized.zip) を使用してください。リリース版の実行に Xcode、Python、Homebrew は不要です。
1. macOS 復旧環境で `csrutil enable --without debug` と `csrutil allow-research-guests enable` を実行し、再起動します。詳しくは[ホストの設定](Guides/host-setup.md)をご覧ください。
2. アーカイブを展開してアプリを開きます。**Host Setup** の案内に従い、開発者ツールへのアクセスを許可して特権ヘルパーをインストールします。
diff --git a/Documents/README_ko.md b/Documents/README_ko.md
index b2fa2993..2c4b7fc0 100644
--- a/Documents/README_ko.md
+++ b/Documents/README_ko.md
@@ -14,7 +14,7 @@ Apple Silicon Mac에서 가상 iPhone을 만들고 실행합니다. vphone-cli
## 시작하기
-macOS 15 이상을 실행하는 물리 Apple Silicon Mac에서는 공증된 [vphone-launchpad 2.0.6](https://github.com/Lakr233/vphone-cli/releases/download/2.0.6/vphone-launchpad-2.0.6-notarized.zip)를 사용하세요. 릴리스 버전을 실행할 때 Xcode, Python, Homebrew는 필요하지 않습니다.
+macOS 15 이상을 실행하는 물리 Apple Silicon Mac에서는 공증된 [vphone-launchpad 2.0.8](https://github.com/Lakr233/vphone-cli/releases/download/2.0.8/vphone-launchpad-2.0.8-notarized.zip)를 사용하세요. 릴리스 버전을 실행할 때 Xcode, Python, Homebrew는 필요하지 않습니다.
1. macOS 복구 환경에서 `csrutil enable --without debug`와 `csrutil allow-research-guests enable`을 실행한 다음 재시동하세요. 자세한 내용은 [호스트 설정](Guides/host-setup.md)을 참고하세요.
2. 압축을 풀고 앱을 여세요. **Host Setup**의 안내에 따라 개발자 도구 접근을 허용하고 권한 있는 도우미를 설치하세요.
diff --git a/Documents/README_zh.md b/Documents/README_zh.md
index f42f1330..a251ac57 100644
--- a/Documents/README_zh.md
+++ b/Documents/README_zh.md
@@ -14,7 +14,7 @@
## 开始使用
-推荐在运行 macOS 15 或更新版本的实体 Apple Silicon Mac 上使用已公证的 [vphone-launchpad 2.0.6](https://github.com/Lakr233/vphone-cli/releases/download/2.0.6/vphone-launchpad-2.0.6-notarized.zip)。运行发布版无需 Xcode、Python 或 Homebrew。
+推荐在运行 macOS 15 或更新版本的实体 Apple Silicon Mac 上使用已公证的 [vphone-launchpad 2.0.8](https://github.com/Lakr233/vphone-cli/releases/download/2.0.8/vphone-launchpad-2.0.8-notarized.zip)。运行发布版无需 Xcode、Python 或 Homebrew。
1. 在 macOS 恢复模式中执行 `csrutil enable --without debug` 和 `csrutil allow-research-guests enable`,然后重新启动。详见[宿主机设置](Guides/host-setup.md)。
2. 解压并打开 App,按 **Host Setup** 的提示授予开发者工具权限并安装特权辅助程序。
diff --git a/README.md b/README.md
index e04d3e86..c5d6b2f7 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ The recommended host setup runs `csrutil enable --without debug` and `csrutil al
## Get started
-Use the notarized [vphone-launchpad 2.0.6](https://github.com/Lakr233/vphone-cli/releases/download/2.0.6/vphone-launchpad-2.0.6-notarized.zip) on a physical Apple Silicon Mac running macOS 15 or newer. The release needs no Xcode, Python, or Homebrew at runtime.
+Use the notarized [vphone-launchpad 2.0.8](https://github.com/Lakr233/vphone-cli/releases/download/2.0.8/vphone-launchpad-2.0.8-notarized.zip) on a physical Apple Silicon Mac running macOS 15 or newer. The release needs no Xcode, Python, or Homebrew at runtime.
1. In macOS Recovery, run `csrutil enable --without debug` and `csrutil allow-research-guests enable`, then restart. See [host setup](Documents/Guides/host-setup.md) for details.
2. Unzip and open the app. Complete **Host Setup**, including Developer Tools access and installation of the privileged helper.
diff --git a/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator.xcodeproj/project.pbxproj b/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator.xcodeproj/project.pbxproj
index 7ac8cf0c..d0e71229 100644
--- a/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator.xcodeproj/project.pbxproj
+++ b/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator.xcodeproj/project.pbxproj
@@ -5,7 +5,7 @@
objectVersion = 70;
objects = {
/* Begin PBXFileReference section */
- EE0000000000000000000031 /* VPhoneEscalator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = VPhoneEscalator; sourceTree = BUILT_PRODUCTS_DIR; };
+ EE0000000000000000000031 /* vphone-escalator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "vphone-escalator"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
EE0000000000000000000021 /* VPhoneEscalator */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VPhoneEscalator; sourceTree = "<group>"; };
@@ -15,7 +15,7 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
EE0000000000000000000002 = {isa = PBXGroup; children = (EE0000000000000000000021 /* VPhoneEscalator */, EE0000000000000000000003 /* Products */, ); sourceTree = "<group>"; };
- EE0000000000000000000003 /* Products */ = {isa = PBXGroup; children = (EE0000000000000000000031 /* VPhoneEscalator */, ); name = Products; sourceTree = "<group>"; };
+ EE0000000000000000000003 /* Products */ = {isa = PBXGroup; children = (EE0000000000000000000031 /* vphone-escalator */, ); name = Products; sourceTree = "<group>"; };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
EE0000000000000000000011 /* VPhoneEscalator */ = {
@@ -26,8 +26,8 @@
dependencies = ();
fileSystemSynchronizedGroups = (EE0000000000000000000021 /* VPhoneEscalator */, );
name = VPhoneEscalator;
- productName = VPhoneEscalator;
- productReference = EE0000000000000000000031 /* VPhoneEscalator */;
+ productName = "vphone-escalator";
+ productReference = EE0000000000000000000031 /* vphone-escalator */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
@@ -49,8 +49,8 @@
EE0000000000000000000051 /* Sources */ = {isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = (); runOnlyForDeploymentPostprocessing = 0; };
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
- EE0000000000000000000061 /* Debug */ = {isa = XCBuildConfiguration; buildSettings = {ARCHS = arm64e; CODE_SIGNING_ALLOWED = NO; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = ("$(inherited)", "-framework", CoreFoundation, "-framework", Security, ); PRODUCT_NAME = VPhoneEscalator; SDKROOT = macosx; }; name = Debug; };
- EE0000000000000000000062 /* Release */ = {isa = XCBuildConfiguration; buildSettings = {ARCHS = arm64e; CODE_SIGNING_ALLOWED = NO; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = ("$(inherited)", "-framework", CoreFoundation, "-framework", Security, ); PRODUCT_NAME = VPhoneEscalator; SDKROOT = macosx; }; name = Release; };
+ EE0000000000000000000061 /* Debug */ = {isa = XCBuildConfiguration; buildSettings = {ARCHS = arm64e; CODE_SIGNING_ALLOWED = NO; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = ("$(inherited)", "-framework", CoreFoundation, "-framework", Security, ); PRODUCT_NAME = "vphone-escalator"; SDKROOT = macosx; }; name = Debug; };
+ EE0000000000000000000062 /* Release */ = {isa = XCBuildConfiguration; buildSettings = {ARCHS = arm64e; CODE_SIGNING_ALLOWED = NO; MACOSX_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = ("$(inherited)", "-framework", CoreFoundation, "-framework", Security, ); PRODUCT_NAME = "vphone-escalator"; SDKROOT = macosx; }; name = Release; };
EE0000000000000000000071 /* Debug */ = {isa = XCBuildConfiguration; buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = arm64e; CODE_SIGNING_ALLOWED = NO; MACOSX_DEPLOYMENT_TARGET = 15.0; SDKROOT = macosx; }; name = Debug; };
EE0000000000000000000072 /* Release */ = {isa = XCBuildConfiguration; buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = arm64e; CODE_SIGNING_ALLOWED = NO; MACOSX_DEPLOYMENT_TARGET = 15.0; SDKROOT = macosx; }; name = Release; };
/* End XCBuildConfiguration section */
diff --git a/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator/VPhoneEscalator.c b/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator/VPhoneEscalator.c
index 9007e26f..ea76e464 100644
--- a/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator/VPhoneEscalator.c
+++ b/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator/VPhoneEscalator.c
@@ -1,4 +1,4 @@
-// VPhoneEscalator — let an ad-hoc signed binary carry Apple-private
+// vphone-escalator — let an ad-hoc signed binary carry Apple-private
// entitlements, without writing a single byte into anyone's __TEXT.
//
// This is the project's copy of github.com/Lakr233/amfi-allow (MIT), built
@@ -111,6 +111,8 @@
#ifndef PREFS_PATH
#define PREFS_PATH "/Library/Preferences/com.apple.security.coderequirements.plist"
#endif
+// Persistent preference key; changing the executable name must not orphan
+// hashes already written under this key.
#define MANAGED_KEY CFSTR("VPhoneEscalator")
#define SCAN_INSNS 64 // +sharedManager is short; this is generous
@@ -639,7 +641,7 @@ static int update_allow_preferences(int count, char **paths) {
if (!base || CFGetTypeID(base) != CFStringGetTypeID() || !valid_hashes(saved) ||
!original_entitlements ||
CFGetTypeID(original_entitlements) != CFBooleanGetTypeID()) {
- fprintf(stderr, "error: invalid %s metadata in %s\n", "VPhoneEscalator", PREFS_PATH);
+ fprintf(stderr, "error: invalid %s metadata in %s\n", "vphone-escalator", PREFS_PATH);
CFRelease(prefs);
return 1;
}
@@ -648,7 +650,7 @@ static int update_allow_preferences(int count, char **paths) {
bool matches = current && CFEqual(current, expected);
CFRelease(expected);
if (!matches) {
- fprintf(stderr, "error: Entitlements changed since VPhoneEscalator wrote it\n");
+ fprintf(stderr, "error: Entitlements changed since vphone-escalator wrote it\n");
CFRelease(hashes);
CFRelease(prefs);
return 1;
@@ -782,7 +784,7 @@ static int remove_allow_preferences(bool *changed) {
CFDictionaryRef managed = CFDictionaryGetValue(prefs, MANAGED_KEY);
if (managed) {
if (CFGetTypeID(managed) != CFDictionaryGetTypeID()) {
- fprintf(stderr, "error: invalid VPhoneEscalator metadata\n");
+ fprintf(stderr, "error: invalid vphone-escalator metadata\n");
CFRelease(prefs);
return 0;
}
@@ -792,7 +794,7 @@ static int remove_allow_preferences(bool *changed) {
if (!base || CFGetTypeID(base) != CFStringGetTypeID() || !valid_hashes(hashes) ||
!had_entitlements ||
CFGetTypeID(had_entitlements) != CFBooleanGetTypeID()) {
- fprintf(stderr, "error: invalid VPhoneEscalator metadata\n");
+ fprintf(stderr, "error: invalid vphone-escalator metadata\n");
CFRelease(prefs);
return 0;
}
@@ -802,7 +804,7 @@ static int remove_allow_preferences(bool *changed) {
CFEqual(current, expected);
CFRelease(expected);
if (!matches) {
- fprintf(stderr, "error: Entitlements changed since VPhoneEscalator wrote it; refusing to remove other rules\n");
+ fprintf(stderr, "error: Entitlements changed since vphone-escalator wrote it; refusing to remove other rules\n");
CFRelease(prefs);
return 0;
}
@@ -812,9 +814,9 @@ static int remove_allow_preferences(bool *changed) {
CFDictionaryRemoveValue(prefs, CFSTR("Entitlements"));
CFDictionaryRemoveValue(prefs, MANAGED_KEY);
if (!write_prefs(prefs)) { CFRelease(prefs); return 0; }
- printf("removed VPhoneEscalator cdhashes from %s\n", PREFS_PATH);
+ printf("removed vphone-escalator cdhashes from %s\n", PREFS_PATH);
} else {
- printf("no VPhoneEscalator entries to remove\n");
+ printf("no vphone-escalator entries to remove\n");
CFRelease(prefs);
return 1;
}
@@ -871,9 +873,9 @@ int main(int argc, char **argv) {
fprintf(stderr,
"usage:\n"
- " VPhoneEscalator status\n"
- " sudo VPhoneEscalator allow [--hold N] <binary> [<binary>...]\n"
- " sudo VPhoneEscalator off\n"
+ " vphone-escalator status\n"
+ " sudo vphone-escalator allow [--hold N] <binary> [<binary>...]\n"
+ " sudo vphone-escalator off\n"
"\n"
"Allow both signed vphone-vm copies after each build.\n");
return 2;
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
index 9f204014..1e5e2ae0 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
@@ -56,7 +56,7 @@ fi
/bin/mkdir -p "$macos" "$guest"
/bin/cp "$TARGET_BUILD_DIR/vphone-vm" "$macos/vphone-vm"
/bin/cp "$command_products/vphone-cli" "$macos/vphone-cli"
-/bin/cp "$amfi_products/VPhoneEscalator" "$macos/VPhoneEscalator"
+/bin/cp "$amfi_products/vphone-escalator" "$macos/vphone-escalator"
/bin/cp "$daemon_products/vphoned" "$guest/vphoned"
/bin/cp "$root/VPhoneDaemon/Configuration/vphoned.plist" "$guest/vphoned.plist"
/bin/cp "$guest_products/launchhook/launchdhook-vphone.dylib" "$guest/launchdhook-vphone.dylib"
@@ -88,7 +88,7 @@ compatibility_library="$(/usr/bin/xcrun swift-stdlib-tool --print \
/usr/bin/codesign --force --sign - "$macos/vphone-cli"
/usr/bin/codesign --force --sign - --entitlements "$root/VPhoneDaemon/Configuration/VPhoneDaemon.entitlements" "$guest/vphoned"
-/usr/bin/codesign --force --sign - "$macos/VPhoneEscalator"
+/usr/bin/codesign --force --sign - "$macos/vphone-escalator"
/usr/bin/codesign --force --sign - "$macos/libswiftCompatibilitySpan.vphone.dylib"
/usr/bin/codesign --force --sign - --entitlements "$root/VPhoneExecutable/VPhoneVirtualization/Resources/VPhoneVirtualization.entitlements" "$macos/vphone-vm"
/usr/bin/codesign --force --sign - "$bundle"
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
index b4dee45e..60f1a8fb 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh
@@ -33,7 +33,7 @@ require_signed_macho() {
}
}
-for name in vphone-vm vphone-cli VPhoneEscalator libswiftCompatibilitySpan.vphone.dylib; do
+for name in vphone-vm vphone-cli vphone-escalator libswiftCompatibilitySpan.vphone.dylib; do
require_signed_macho "$macos/$name"
done
for name in vphoned launchdhook-vphone.dylib SystemHook-vphone.dylib libcamfix.dylib libvlocation.dylib \
@@ -44,7 +44,7 @@ for name in vphoned.plist libcamfix.plist libvcamcaptured.plist; do
[[ -f "$guest/$name" ]] || { print -u2 "Missing guest configuration: $name"; exit 1; }
done
-for name in vphoned vphoned.signed vphone-app VPhoneAMFIAllow vphone-archive icli vpregister \
+for name in vphoned vphoned.signed vphone-app VPhoneAMFIAllow VPhoneEscalator vphone-archive icli vpregister \
vphone-ask-for-permission libcamfix.dylib libvlocation.dylib libvcamcaptured.dylib launchdhook-vphone.dylib \
SystemHook-vphone.dylib libAppleParavirtCompilerPluginIOGPUFamily.dylib; do
[[ ! -e "$macos/$name" ]] || { print -u2 "Obsolete binary: Contents/MacOS/$name"; exit 1; }
@@ -101,7 +101,7 @@ daemon_entitlements="$(/usr/bin/codesign -d --entitlements - --xml "$guest/vphon
print -u2 "vphoned has the wrong entitlements"
exit 1
}
-for name in vphone-cli VPhoneEscalator; do
+for name in vphone-cli vphone-escalator; do
process_entitlements="$(/usr/bin/codesign -d --entitlements - --xml "$macos/$name" 2>/dev/null || true)"
[[ "$process_entitlements" != *'com.apple.private.virtualization'* &&
"$process_entitlements" != *'com.apple.CommCenter.fine-grained'* ]] || {
@@ -110,7 +110,7 @@ for name in vphone-cli VPhoneEscalator; do
}
done
-for name in vphone-vm vphone-cli VPhoneEscalator; do
+for name in vphone-vm vphone-cli vphone-escalator; do
/usr/bin/otool -L "$macos/$name" | /usr/bin/awk 'NR > 1 {print $1}' |
while IFS= read -r dependency; do
case "$dependency" in
diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist
index 91e089a1..c06844c9 100644
--- a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist
+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist
@@ -9,9 +9,9 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleVersion</key>
- <string>8</string>
+ <string>9</string>
<key>CFBundleShortVersionString</key>
- <string>2.0.6</string>
+ <string>2.0.8</string>
<key>NSLocationUsageDescription</key>
<string>Shares your location with the virtual iPhone so apps running inside it see the same location.</string>
<key>NSLocationWhenInUseUsageDescription</key>
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuBootstrap.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuBootstrap.swift
index 89850c89..b1dd041c 100644
--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuBootstrap.swift
+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuBootstrap.swift
@@ -73,12 +73,14 @@ extension VPhoneMenuController {
}
let close = alert.addButton(withTitle: VPhoneLocalization.text("Close"))
close.isEnabled = false
+ // NSAlert places the accessory 16 points from each edge; inset its
+ // contents another 6 points to align with the alert's text columns.
let accessory = NSView(frame: NSRect(x: 0, y: 0, width: 360, height: 52))
let statusLabel = NSTextField(labelWithString: VPhoneLocalization.text("Preparing bootstrap…"))
- statusLabel.frame = NSRect(x: 0, y: 26, width: 360, height: 22)
+ statusLabel.frame = NSRect(x: 6, y: 26, width: 348, height: 22)
statusLabel.lineBreakMode = .byTruncatingMiddle
accessory.addSubview(statusLabel)
- let indicator = NSProgressIndicator(frame: NSRect(x: 0, y: 4, width: 360, height: 16))
+ let indicator = NSProgressIndicator(frame: NSRect(x: 6, y: 4, width: 348, height: 16))
indicator.style = .bar
indicator.isIndeterminate = true
indicator.startAnimation(nil)
@@ -95,7 +97,9 @@ extension VPhoneMenuController {
updateBootstrapUninstallAvailability(
available: control.isConnected && control.guestCapabilities.contains("bootstrap_uninstall"),
)
- indicator.stopAnimation(nil)
+ if indicator.isIndeterminate {
+ indicator.stopAnimation(nil)
+ }
close.isEnabled = true
}
let poller = Task {
@@ -109,9 +113,12 @@ extension VPhoneMenuController {
do {
let result = try await control.installBootstrap(layout: layout, localURL: localURL)
poller.cancel()
+ await poller.value
let version = result["version"] as? String ?? ""
let root = result["jbroot"] as? String ?? ""
indicator.isIndeterminate = false
+ indicator.minValue = 0
+ indicator.maxValue = 100
indicator.doubleValue = 100
statusLabel.stringValue = VPhoneLocalization.text("Bootstrap installed")
alert.informativeText = if result["service_start_warning"] as? String != nil {
@@ -125,6 +132,7 @@ extension VPhoneMenuController {
}
} catch {
poller.cancel()
+ await poller.value
statusLabel.stringValue = VPhoneLocalization.text("Bootstrap installation failed")
alert.alertStyle = .warning
alert.informativeText = if localURL != nil {
diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestLauncher.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestLauncher.swift
index 90766e1b..0210a2fa 100644
--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestLauncher.swift
+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestLauncher.swift
@@ -20,7 +20,7 @@ public enum VPhoneGuestLaunchError: Error, CustomStringConvertible {
case let .blockedByAMFI(guest, cdHash):
let helper = guest.deletingLastPathComponent()
- .appendingPathComponent("VPhoneEscalator")
+ .appendingPathComponent("vphone-escalator")
return """
AMFI blocked vphone-vm, so the VM could not start.
diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift
index 8804aac2..68fd016a 100644
--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift
+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift
@@ -41,7 +41,7 @@ extension VPhoneManifestError: CustomStringConvertible, LocalizedError {
enum VPhoneRuntimeVersion {
/// A plain `swift build` executable has no app bundle Info.plist.
- private static let unbundledVersion = "2.0.6"
+ private static let unbundledVersion = "2.0.8"
static var current: String {
let contents = VPhoneResources.runningExecutable().deletingLastPathComponent().deletingLastPathComponent()
diff --git a/VPhoneLaunchpad/Configuration/Version.xcconfig b/VPhoneLaunchpad/Configuration/Version.xcconfig
index 13fafa9a..ddb27aef 100644
--- a/VPhoneLaunchpad/Configuration/Version.xcconfig
+++ b/VPhoneLaunchpad/Configuration/Version.xcconfig
@@ -1,4 +1,4 @@
-MARKETING_VERSION = 0.1.0
+MARKETING_VERSION = 2.0.8
// Bump whenever the helper changes. The app blesses the helper again when the
// installed helper's version or bytes differ from the copy it embeds.
-CURRENT_PROJECT_VERSION = 4
+CURRENT_PROJECT_VERSION = 5
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
index 642b0301..3f49c025 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
@@ -171,7 +171,9 @@ final class VPhoneLaunchpadModel {
setupCompleted = true
}
let after = sections
- if selectNewest || after.count > before.count || !after.contains(selection) {
+ if selectNewest {
+ selection = !host.requiredPassed ? .hostSetup : bundles.isReady ? .machines : .coreBundle
+ } else if after.count > before.count || !after.contains(selection) {
selection = after.last ?? .hostSetup
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift
index b860cbfd..4b5a01b9 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundle.swift
@@ -101,10 +101,10 @@ final class VPhoneLaunchpadCoreBundle {
get {
access(keyPath: \.activeVersion)
let stored = UserDefaults.standard.string(forKey: Self.activeVersionKey)
- if let stored, installed.contains(where: { $0.version == stored }) {
+ if let stored, installed.contains(where: { $0.version == stored && VPhoneLaunchpadNames.isCompatibleBundleVersion($0.version) }) {
return stored
}
- return installed.first?.version
+ return installed.first { VPhoneLaunchpadNames.isCompatibleBundleVersion($0.version) }?.version
}
set {
withMutation(keyPath: \.activeVersion) {
@@ -174,13 +174,28 @@ final class VPhoneLaunchpadCoreBundle {
.compactMap(VPhoneLaunchpadBundleReceipt.load)
.sorted { $0.version.compare($1.version, options: .numeric) == .orderedDescending }
installed = receipts.map { receipt in
- installed.first { $0.version == receipt.version && $0.receipt == receipt } ?? Installed(receipt: receipt)
+ var item = installed.first { $0.version == receipt.version && $0.receipt == receipt }
+ ?? Installed(receipt: receipt)
+ if !VPhoneLaunchpadNames.isCompatibleBundleVersion(receipt.version) {
+ item.policy = .failed
+ item.preflight = .failed
+ item.preflightDetail = String(localized: "Requires VPhone.bundle \(VPhoneLaunchpadNames.minimumBundleVersion) or newer.")
+ }
+ return item
}
}
/// Adds the execution policy exception, allows an AMFI-refused VM through
/// the root helper, and runs host preflight again for confirmation.
func verify(_ version: String) async {
+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else {
+ update(version) {
+ $0.policy = .failed
+ $0.preflight = .failed
+ $0.preflightDetail = String(localized: "Requires VPhone.bundle \(VPhoneLaunchpadNames.minimumBundleVersion) or newer.")
+ }
+ return
+ }
update(version) {
$0.policy = .running
$0.preflight = .running
@@ -335,6 +350,7 @@ final class VPhoneLaunchpadCoreBundle {
// MARK: - Use and remove
func use(_ version: String) async {
+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else { return }
activeVersion = version
await verify(version)
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
index 0aae3942..2fe6deb9 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
@@ -184,8 +184,9 @@ struct VPhoneLaunchpadCoreBundleView: View {
.help(bundle.preflightDetail)
Menu {
Button("Use This Version") { Task { await bundles.use(bundle.version) } }
- .disabled(isActive)
+ .disabled(isActive || !VPhoneLaunchpadNames.isCompatibleBundleVersion(bundle.version))
Button("Run Preflight Again") { Task { await bundles.verify(bundle.version) } }
+ .disabled(!VPhoneLaunchpadNames.isCompatibleBundleVersion(bundle.version))
Button("Show in Finder") {
NSWorkspace.shared.activateFileViewerSelecting([VPhoneLaunchpadBundleStore.bundle(version: bundle.version)])
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift
index 94a949d9..8f00a9bf 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadLocalBundle.swift
@@ -96,8 +96,8 @@ nonisolated struct VPhoneLaunchpadLocalBundle: Sendable {
throw notVPhoneBundle(source)
}
let version = shortVersion + versionSuffix
- guard VPhoneLaunchpadNames.isValidVersion(version) else {
- throw VPhoneLaunchpadError(String(localized: "VPhone.bundle has an unsupported version \"\(shortVersion)\"."))
+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else {
+ throw VPhoneLaunchpadError(String(localized: "VPhone.bundle \(shortVersion) is not supported. Use version \(VPhoneLaunchpadNames.minimumBundleVersion) or newer."))
}
return version
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadRelease.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadRelease.swift
index bef787df..bebac3f3 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadRelease.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadRelease.swift
@@ -33,7 +33,7 @@ nonisolated struct VPhoneLaunchpadRelease: Identifiable, Hashable, Sendable {
decoder.dateDecodingStrategy = .iso8601
let payload = try decoder.decode([Payload].self, from: data)
return payload.compactMap { release in
- guard !release.draft, VPhoneLaunchpadNames.isValidVersion(release.tag_name) else {
+ guard !release.draft, VPhoneLaunchpadNames.isCompatibleBundleVersion(release.tag_name) else {
return nil
}
let asset = release.assets.first {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
index 0f948bce..5920d73b 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
@@ -6825,6 +6825,40 @@
}
}
},
+ "Requires VPhone.bundle %@ or newer." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Requires VPhone.bundle %@ or newer."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "VPhone.bundle %@ 以降が必要です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "VPhone.bundle %@ 이상이 필요합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cần VPhone.bundle phiên bản %@ trở lên."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "需要 VPhone.bundle %@ 或更新版本。"
+ }
+ }
+ }
+ },
"Restore" : {
"localizations" : {
"en" : {
@@ -9817,6 +9851,40 @@
}
}
},
+ "VPhone.bundle %1$@ is not supported. Use version %2$@ or newer." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "VPhone.bundle %1$@ is not supported. Use version %2$@ or newer."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "VPhone.bundle %1$@ は非対応です。%2$@ 以降を使用してください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "VPhone.bundle %1$@은(는) 지원되지 않습니다. %2$@ 이상을 사용하세요."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "VPhone.bundle %1$@ không được hỗ trợ. Hãy dùng phiên bản %2$@ trở lên."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不支持 VPhone.bundle %1$@。请使用 %2$@ 或更新版本。"
+ }
+ }
+ }
+ },
"vphoned did not answer within 300 seconds." : {
"localizations" : {
"en" : {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperAMFI.swift b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperAMFI.swift
index 7b45ab16..0e512d6e 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperAMFI.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperAMFI.swift
@@ -13,7 +13,7 @@ enum VPhoneLaunchpadHelperAMFI {
try VPhoneLaunchpadHostPolicy.requireReady()
- guard VPhoneLaunchpadNames.isValidVersion(bundleVersion),
+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(bundleVersion),
let receipt = VPhoneLaunchpadBundleReceipt.load(version: bundleVersion)
else {
throw VPhoneLaunchpadHelperError("VPhone.bundle \(bundleVersion) is not installed. Reinstall it, then try again.")
@@ -21,7 +21,7 @@ enum VPhoneLaunchpadHelperAMFI {
let bundle = VPhoneLaunchpadBundleStore.bundle(version: bundleVersion)
let vm = VPhoneLaunchpadBundleStore.executable(version: bundleVersion, named: "vphone-vm")
- let escalator = VPhoneLaunchpadBundleStore.executable(version: bundleVersion, named: "VPhoneEscalator")
+ let escalator = VPhoneLaunchpadBundleStore.executable(version: bundleVersion, named: "vphone-escalator")
try VPhoneLaunchpadHelperCodeCheck.requireValidBundle(bundle)
try VPhoneLaunchpadHelperCodeCheck.requireCDHash(vm, receipt.cdhashes["vphone-vm"])
@@ -31,7 +31,7 @@ enum VPhoneLaunchpadHelperAMFI {
info.st_uid == 0,
info.st_mode & 0o022 == 0
else {
- throw VPhoneLaunchpadHelperError("VPhoneEscalator is missing or is not root-owned. Reinstall VPhone.bundle.")
+ throw VPhoneLaunchpadHelperError("vphone-escalator is missing or is not root-owned. Reinstall VPhone.bundle.")
}
let process = Process()
@@ -44,13 +44,13 @@ enum VPhoneLaunchpadHelperAMFI {
do {
try process.run()
} catch {
- throw VPhoneLaunchpadHelperError("Unable to start VPhoneEscalator: \(error.localizedDescription)")
+ throw VPhoneLaunchpadHelperError("Unable to start vphone-escalator: \(error.localizedDescription)")
}
let text = String(decoding: output.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self)
.trimmingCharacters(in: .whitespacesAndNewlines)
process.waitUntilExit()
guard process.terminationReason == .exit, process.terminationStatus == 0 else {
- throw VPhoneLaunchpadHelperError(text.isEmpty ? "VPhoneEscalator failed. Check the host's SIP settings." : text)
+ throw VPhoneLaunchpadHelperError(text.isEmpty ? "vphone-escalator failed. Check the host's SIP settings." : text)
}
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperBundleInstaller.swift b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperBundleInstaller.swift
index 396a1596..477f7db5 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperBundleInstaller.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperBundleInstaller.swift
@@ -5,8 +5,8 @@ import Foundation
/// Installs one VPhone.bundle release into the root-owned store.
enum VPhoneLaunchpadHelperBundleInstaller {
static func install(version: String, archive: FileHandle, sha256: String) throws {
- guard VPhoneLaunchpadNames.isValidVersion(version) else {
- throw VPhoneLaunchpadHelperError("\"\(version)\" is not a valid bundle version.")
+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(version) else {
+ throw VPhoneLaunchpadHelperError("VPhone.bundle \(version) is not supported. Use \(VPhoneLaunchpadNames.minimumBundleVersion) or newer.")
}
let expected = sha256.lowercased().replacingOccurrences(of: "sha256:", with: "")
guard expected.range(of: "^[0-9a-f]{64}$", options: .regularExpression) != nil else {
@@ -36,12 +36,20 @@ enum VPhoneLaunchpadHelperBundleInstaller {
try runTool("/usr/bin/ditto", ["-x", "-k", "--noqtn", archiveURL.path, extracted.path])
let bundle = extracted.appendingPathComponent("VPhone.bundle", isDirectory: true)
try requireDirectory(bundle, "The download does not contain VPhone.bundle. Download it again.")
- for name in VPhoneLaunchpadBundleStore.pinnedExecutables {
+ for name in VPhoneLaunchpadBundleStore.pinnedExecutables + ["vphone-escalator"] {
let executable = bundle.appendingPathComponent("Contents/MacOS/\(name)")
try requireRegularFile(executable, "VPhone.bundle is missing \(name). Download it again.")
}
try VPhoneLaunchpadHelperCodeCheck.requireValidBundle(bundle)
+ let infoURL = bundle.appendingPathComponent("Contents/Info.plist")
+ let info = try PropertyListSerialization.propertyList(from: Data(contentsOf: infoURL), format: nil)
+ let bundleVersion = (info as? [String: Any])?["CFBundleShortVersionString"] as? String
+ guard let bundleVersion, VPhoneLaunchpadNames.isCompatibleBundleVersion(bundleVersion),
+ version == bundleVersion || version == "\(bundleVersion)-local"
+ else {
+ throw VPhoneLaunchpadHelperError("VPhone.bundle version does not match \(version). Download it again.")
+ }
var cdhashes: [String: String] = [:]
for name in VPhoneLaunchpadBundleStore.pinnedExecutables {
cdhashes[name] = try VPhoneLaunchpadHelperCodeCheck.cdhash(
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift
index cb77d9d2..fd14b0eb 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift
@@ -19,8 +19,8 @@ struct VPhoneLaunchpadHelperFirmwareRequest {
callerUID: uid_t,
callerGID: gid_t,
) throws {
- guard VPhoneLaunchpadNames.isValidVersion(bundleVersion) else {
- throw VPhoneLaunchpadHelperError("\"\(bundleVersion)\" is not a valid bundle version.")
+ guard VPhoneLaunchpadNames.isCompatibleBundleVersion(bundleVersion) else {
+ throw VPhoneLaunchpadHelperError("VPhone.bundle \(bundleVersion) is not supported. Use \(VPhoneLaunchpadNames.minimumBundleVersion) or newer.")
}
guard let receipt = VPhoneLaunchpadBundleReceipt.load(version: bundleVersion) else {
throw VPhoneLaunchpadHelperError("VPhone.bundle \(bundleVersion) is not installed. Install it in Core Bundle, then try again.")
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
index 8fd0ab66..50ad90a6 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift
@@ -70,10 +70,22 @@ nonisolated struct VPhoneLaunchpadBundleReceipt: Codable, Equatable, Sendable {
/// checks them to give an early message; the helper checks them because it
/// must not trust the app.
nonisolated enum VPhoneLaunchpadNames {
+ static let minimumBundleVersion = "2.0.8"
+
static func isValidVersion(_ value: String) -> Bool {
matches(value, "^[0-9A-Za-z][0-9A-Za-z._-]{0,63}$") && !value.contains("..")
}
+ static func isCompatibleBundleVersion(_ value: String) -> Bool {
+ guard isValidVersion(value) else { return false }
+ let release = value.hasSuffix("-local") ? String(value.dropLast("-local".count)) : value
+ let parts = release.split(separator: ".", omittingEmptySubsequences: false)
+ guard parts.count == 3,
+ let major = Int(parts[0]), let minor = Int(parts[1]), let patch = Int(parts[2])
+ else { return false }
+ return (major, minor, patch) >= (2, 0, 8)
+ }
+
static func isValidMachineName(_ value: String) -> Bool {
matches(value, "^[0-9A-Za-z][0-9A-Za-z._-]{0,63}$") && !value.contains("..")
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift
index e59058cd..a79baa75 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift
@@ -42,7 +42,7 @@ nonisolated protocol VPhoneLaunchpadHelperProtocol {
func removeBundle(authorization: Data, version: String, reply: @escaping @Sendable (String?) -> Void)
/// Allows only the installed bundle's receipt-pinned vphone-vm through
- /// AMFI, using that bundle's VPhoneEscalator as root.
+ /// AMFI, using that bundle's vphone-escalator as root.
func allowVirtualMachine(authorization: Data, bundleVersion: String, reply: @escaping @Sendable (String?) -> Void)
/// Runs `vphone-cli cfw install` from a store bundle as root, on behalf of