Skip to content

Control a real USB-connected iPhone from Linux (no Mac, no paid developer account) and expose it to AI agents as MCP tools

fix(sign): keep anisette header values' case so Apple login isn't 403 (#172)

Qinghe Li00953537715f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 970f7c5..d39e6b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ What changed in each release, one line per change. Versions follow [Semantic Ver
## [Unreleased]
+### Fixes
+
+- `iphone-control login` and the setup wizard no longer fail with HTTP 403 from Apple before the password is checked. The `X-MMe-Client-Info` header sent to Apple was lowercased (`mac os x`), which Apple now rejects (#171).
+
## [0.2.10] - 2026-11-22
### Upgrade notes
diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md
index e9bafe6..7d02dc6 100644
--- a/CHANGELOG.zh-CN.md
+++ b/CHANGELOG.zh-CN.md
@@ -6,6 +6,10 @@
## [Unreleased]
+### 修复
+
+- `iphone-control login` 和设置向导不再在核对密码之前就收到苹果的 HTTP 403。发给苹果的 `X-MMe-Client-Info` 头被转成了小写(`mac os x`),苹果现在会拒绝这样的请求(#171)。
+
## [0.2.10] - 2026-11-22
### 升级注意事项
diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md
index 147487c..7ee1459 100644
--- a/THIRD_PARTY.md
+++ b/THIRD_PARTY.md
@@ -9,7 +9,7 @@
| [jktcp](https://crates.io/crates/jktcp) | 0.1.8(间接) | MIT | crates.io | 无 |
| [rmcp](https://github.com/modelcontextprotocol/rust-sdk) | 3.8.0 | Apache-2.0(部分历史代码 MIT) | crates.io | 无 |
| [apple-codesign](https://github.com/indygreg/apple-platform-rs) | 0.29.0(取自 Impactor `3rdparty/apple-codesign-0.29.0`) | MPL-2.0 | `vendor/apple-codesign`,`[patch.crates-io]` | Impactor 的 0o755 权限补丁(上游提交 428b42f);本仓库删掉了上游的 `tests/`、`docs/`、`src/testdata/`(单元测试的证书和密钥样例)、`Cargo.lock`、`Cargo.toml.orig`,Cargo.toml 去掉 `[[test]]` 目标、`zip` 依赖从 2.x 升到 9.5.1(修安全告警;只有公证功能用它写 zip,API 兼容)、`dialoguer` 从 0.11 升到 0.12(和本项目共用 console 0.16;只有它的命令行界面用到,本项目不调用),源码未改(因此 vendor 里的单元测试不能运行,本仓库也不跑它们) |
-| [Impactor](https://github.com/claration/impactor) `plume_core` | v2.7.2(提交 b13d99559febd63e3710dfdd0ef8cdd78d10ae13) | MPL-2.0 | `vendor/plume_core` | `src/utils/certificate.rs` 生成证书请求的几行改成 rcgen 0.14 的写法(和本项目共用一份 rcgen,同样只开 `ring`、`pem`),其余源码未改;Cargo.toml 把 workspace 继承展开成显式版本、修正 omnisette 路径;reqwest 用 `rustls-no-provider`(不编 aws-lc-rs);omnisette 改为 `default-features = false, features = ["remote-anisette", "remote-anisette-v3"]` |
+| [Impactor](https://github.com/claration/impactor) `plume_core` | v2.7.2(提交 b13d99559febd63e3710dfdd0ef8cdd78d10ae13) | MPL-2.0 | `vendor/plume_core` | `src/utils/certificate.rs` 生成证书请求的几行改成 rcgen 0.14 的写法(和本项目共用一份 rcgen,同样只开 `ring`、`pem`);`src/auth/anisette_data.rs` 的 `get_header` 不再把头的值转成小写(上游把 `X-MMe-Client-Info` 发成小写,苹果回 403,#171;改动处有注释);其余源码未改;Cargo.toml 把 workspace 继承展开成显式版本、修正 omnisette 路径;reqwest 用 `rustls-no-provider`(不编 aws-lc-rs);omnisette 改为 `default-features = false, features = ["remote-anisette", "remote-anisette-v3"]` |
| Impactor `plume_store` | 同上 | MIT | `vendor/plume_store` | 源码未改;Cargo.toml 展开 workspace 继承 |
| Impactor `omnisette` | 同上 | MPL-2.0 | `vendor/omnisette` | `src/lib.rs` 加了 `anisette_url_v3()`/`set_anisette_url_v3()`(原来 v3 地址没有 setter,自建 anisette 服务配不进去;改动处有注释,文件仍是 MPL-2.0);Cargo.toml 展开 workspace 继承;reqwest 用 `rustls-no-provider`;本地 anisette(StoreServicesCore,要苹果 Android 版的 `libstoreservicescore.so` 和没有许可证声明的 git 依赖 `android-loader`)改成可选 feature `local-anisette`,默认 feature 里保留与上游一致,本项目不启用(只用远程 anisette v3) |
| Impactor `plume_utils` | 同上 | MIT | 未 vendor;`crates/ictl-sign/src/bundle.rs` 改写自其 `bundle.rs` | 增加 `BundleType::XCTest`,修复 `.xctest` 漏签 |
diff --git a/crates/ictl-sign/src/lib.rs b/crates/ictl-sign/src/lib.rs
index 745cb05..ef44d6e 100644
--- a/crates/ictl-sign/src/lib.rs
+++ b/crates/ictl-sign/src/lib.rs
@@ -372,6 +372,31 @@ mod tests {
let default = AccountDir { dir: PathBuf::from("/tmp/x"), anisette_url: None };
assert_eq!(default.anisette().anisette_url_v3(), "https://mac-ani.jkcoxson.com");
}
+
+ /// 取 anisette 头只有名字不分大小写,值要原样发:`X-MMe-Client-Info` 里的 `Mac OS X` 变成小写,
+ /// 苹果 GSA 直接回 403,登录失败(#171)。plume_core 在 vendor 里、不在 workspace,测试放在这里才会在 CI 跑
+ #[test]
+ fn anisette_header_values_keep_their_case() {
+ use plume_core::auth::anisette_data::AnisetteData;
+ let anisette = AnisetteData {
+ base_headers: std::collections::HashMap::from([
+ (
+ "X-Mme-Client-Info".to_owned(),
+ "<MacBookPro13,3> <Mac OS X;10.12.6;16G29> <com.apple.AuthKit/1 (com.apple.dt.Xcode/3594.4.19)>"
+ .to_owned(),
+ ),
+ ("X-Apple-Locale".to_owned(), "en_US".to_owned()),
+ ]),
+ generated_at: SystemTime::now(),
+ config: AnisetteConfiguration::default(),
+ };
+ assert_eq!(
+ anisette.get_header("x-mme-client-info").unwrap(),
+ "<MacBookPro13,3> <Mac OS X;10.12.6;16G29> <com.apple.AuthKit/1 (com.apple.akd/1.0)>"
+ );
+ assert_eq!(anisette.get_header("x-apple-locale").unwrap(), "en_US");
+ assert_eq!(anisette.get_header("X-Apple-Locale").unwrap(), "en_US");
+ }
use std::time::{Duration, SystemTime};
#[test]
diff --git a/docs/licensing.md b/docs/licensing.md
index e2b7e68..7a434d4 100644
--- a/docs/licensing.md
+++ b/docs/licensing.md
@@ -12,7 +12,7 @@
|---|---|---|---|---|
| idevice(上游 master `89702099`) | 设备通讯 | MIT | git 依赖(`[patch.crates-io]`,0.1.68 之后未发版的修复);`ictl-device/src/media.rs` 与 HID 键码表改写自它的 tools、`oslog.rs` 的日志条目格式取自它的 os_trace_relay(MIT) | 保留版权声明 |
| jktcp 0.1.8 | 用户态 TCP(idevice 间接依赖) | MIT | 间接依赖 | 同上 |
-| plume_core(Impactor) | Apple ID、开发者 API、描述文件、证书 | **MPL-2.0**(目录内 LICENSE) | vendor 到 `vendor/plume_core`,源码未改,只改了 Cargo.toml(workspace 继承、reqwest 不带 aws-lc-rs、omnisette 只开远程 anisette) | 以 MPL-2.0 随仓库提供源码;文件头保留 |
+| plume_core(Impactor) | Apple ID、开发者 API、描述文件、证书 | **MPL-2.0**(目录内 LICENSE) | vendor 到 `vendor/plume_core`,源码只改了两处(`certificate.rs` 适配 rcgen 0.14;`anisette_data.rs` 取头时不再把值转小写,#171),另改了 Cargo.toml(workspace 继承、reqwest 不带 aws-lc-rs、omnisette 只开远程 anisette) | 以 MPL-2.0 随仓库提供源码;文件头保留 |
| plume_store(Impactor) | 账号会话存储 | MIT(Impactor 根 LICENSE) | vendor 到 `vendor/plume_store`,源码未改 | 保留版权声明(`vendor/plume_store/LICENSE-MIT-Impactor`) |
| omnisette(Impactor 3rdparty) | anisette 数据 | **MPL-2.0**(目录内 LICENSE;早期文档误写为 MIT,读源码后更正) | vendor 到 `vendor/omnisette`,`src/lib.rs` 加了 v3 服务地址的 getter/setter(自建 anisette 服务才能生效),其余源码未改;Cargo.toml 把本地 anisette 改成可选 feature `local-anisette`,本项目不启用,所以不编译没有许可证声明的 `android-loader`/`sysv64` 和 AGPL-3.0 的 `remove-async-await` | 同 plume_core |
| plume_utils(Impactor) | Bundle、Signer | MIT(Impactor 根 LICENSE) | **未 vendor**:`ictl-sign/src/bundle.rs` 改写自它的 `bundle.rs`,签名流程在 `ictl-sign/src/lib.rs` 重写 | 文件头注明来源和版权 |
diff --git a/vendor/plume_core/src/auth/anisette_data.rs b/vendor/plume_core/src/auth/anisette_data.rs
index 1db931a..a985270 100644
--- a/vendor/plume_core/src/auth/anisette_data.rs
+++ b/vendor/plume_core/src/auth/anisette_data.rs
@@ -101,7 +101,9 @@ impl AnisetteData {
let headers = self
.generate_headers(true, true, true)
.iter()
- .map(|(k, v)| (k.to_lowercase(), v.to_lowercase()))
+ // iphone-control: only the name is case-insensitive. Upstream lowercased the value too, so
+ // X-MMe-Client-Info went out as `<mac os x;…>` and Apple's GSA has answered 403 since 2026-11 (#171)
+ .map(|(k, v)| (k.to_lowercase(), v.clone()))
.collect::<HashMap<String, String>>();
match headers.get(&header.to_lowercase()) {