Skip to content

Commit 256f912

Browse files
Sign in as the Android device the ADI libraries actually are
Since 2026-10-12 Grand Slam refuses SRP init (ec=-80045) when a machine id minted by Apple's Android ADI libraries is presented under a macOS or iPhone client-info - issue wanderdev0#248, and every install of this app. - Hardware.ANDROID (Pixel 7 / Android 14 / UQ1A.240205.002, the string xtool verified in xtool-org/xtool#337) is the new DEFAULT; canSignIn() marks LEGACY_MAC and IPHONE as refused at the handler - LocalAnisette replaces a stored identity whose profile can no longer sign in and wipes files/anisette/provisioning before the library is opened, so ADI re-provisions under the Android claim - a Mac-provisioned machine id presented as Android is answered hsc=434. Costs affected installs one re-login; the alternative is an install that can never sign in again - profileToShow describes the profile the next load will actually use - gsd.apple.com now chains to Apple Root CA - G3: added as a trust anchor beside the 2006 root, for gsa and gsd only. This is the -45003/502 every public Anisette server has been returning; without it the on-device provisioning handshake itself fails - Tests: AdiDeviceIdentityTest pins the Android client-info string and canSignIn(); LocalAnisetteIdentityTest covers keep-vs-replace and the provisioning wipe; test_identity.py pins that the six bridged values render as the verified client-info through FindMy.py's own composer Verified end to end: a freshly Android-provisioned machine id answers ec=0 via scripts/probe_gsa_signin.py --real-init, and on a Pixel 8 Pro this build downloads the libraries, provisions under the Android identity (ADIProvisioningEnd = 0) and signs in - password and 2FA accepted - through to the account step. 469 JVM tests, 46 pytest, 35 instrumented tests green. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 2065d59 commit 256f912

8 files changed

Lines changed: 381 additions & 120 deletions

File tree

‎AGENTS.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,23 @@ python -m venv .venv && .venv/bin/pip install "FindMy==<pinned version>"
151151
the pre-fix stub back and requires the job to fail. `native-stubs.yml` checks the stubs' exports
152152
and return conventions on their own, in seconds.
153153

154+
- **The machine id carries its provenance, and Grand Slam reads it.** The libraries are Apple's
155+
Android ADI binaries, and the `X-Apple-I-MD-M` they mint says so. Since 2026-10-12 the
156+
GsService2 handler refuses SRP init with `ec=-80045` when that machine id is presented under a
157+
client-info claiming macOS or iPhone — before the password, before the OTP (a wrong OTP still
158+
gets `-80045`; a missing one gets `-80010`). An Android client-info over the same machine id is
159+
answered `ec=0`. That is why `AdiDeviceIdentity` claims a Pixel 7 and why `canSignIn()` exists:
160+
provenance is bound at provisioning, so a Mac-provisioned machine presented as Android is
161+
answered `hsc=434` — the profile must be set before `ADISetProvisioningPath`, and moving an
162+
install means wiping `anisette/provisioning`, not just the preference. The field-level matrix
163+
is reproducible with `scripts/probe_gsa_signin.py --real-init`, which needs no credentials.
164+
- **`gsd.apple.com` chains to Apple Root CA - G3; nothing else in the world does.** The two
165+
provisioning endpoints the URL bag points at are served under a root that is in no shipped
166+
trust store — not Android's, not the anisette package's bundled one. It is in
167+
`network_security_config.xml` for `gsa` and `gsd` only, as a PEM in `res/raw` so a diff can
168+
review it. Remove it and provisioning fails the handshake; every public Anisette server
169+
hitting `-45003`/502 in October 2026 was this.
170+
154171
### 5. Never bundle an AMap API key
155172

156173
AMap issues keys per developer account, bound to a package name and signing fingerprint, and

‎app/src/androidTest/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentityTest.java‎

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dev.wander.android.opentagviewer.anisette;
22

33
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertFalse;
45
import static org.junit.Assert.assertNotEquals;
56
import static org.junit.Assert.assertTrue;
67

@@ -101,9 +102,12 @@ public void everyProfileIsInternallyConsistent() throws Exception {
101102
for (final Hardware hardware : Hardware.values()) {
102103
final JSONObject json = new JSONObject(hardware.toJson());
103104
final boolean phone = json.getString("model").startsWith("iPhone");
105+
final boolean android = "Android".equals(json.getString("os_name"));
104106

105107
assertEquals(hardware + " names a phone in one field and a Mac in another",
106108
phone, "iPhone OS".equals(json.getString("os_name")));
109+
assertEquals(hardware + " names Android in one field and Apple hardware in another",
110+
android, "Pixel 7".equals(json.getString("model")));
107111
assertEquals(hardware + "'s user agent describes a different release",
108112
hardware.userAgent(),
109113
"akd/1.0 CFNetwork/" + hardware.cfnetwork()
@@ -114,8 +118,34 @@ public void everyProfileIsInternallyConsistent() throws Exception {
114118
/** Two profiles that were the same machine would make the distinction meaningless. */
115119
@Test
116120
public void theProfilesAreActuallyDifferentMachines() {
117-
assertNotEquals(Hardware.LEGACY_MAC.toJson(), Hardware.IPHONE.toJson());
118-
assertNotEquals(Hardware.LEGACY_MAC.clientInfo(), Hardware.IPHONE.clientInfo());
121+
final Hardware[] all = Hardware.values();
122+
for (int i = 0; i < all.length; i++) {
123+
for (int j = i + 1; j < all.length; j++) {
124+
assertNotEquals(all[i] + " and " + all[j] + " are one machine",
125+
all[i].toJson(), all[j].toJson());
126+
assertNotEquals(all[i] + " and " + all[j] + " are one machine",
127+
all[i].clientInfo(), all[j].clientInfo());
128+
}
129+
}
130+
}
131+
132+
/**
133+
* The Android profile is the exact string the Grand Slam handler was verified to accept.
134+
*
135+
* <p>Verified on 2026-10-14 with {@code scripts/probe_gsa_signin.py --real-init}: a machine
136+
* id provisioned under this client info, presented with this client info, is answered
137+
* {@code ec=0} and an SRP challenge; the same machine id under the Mac's is answered
138+
* {@code ec=-80045}. It is also the string xtool shipped in xtool-org/xtool#337. One
139+
* character of drift here is a sign-in nobody can complete, so the whole string is pinned.
140+
*/
141+
@Test
142+
public void theAndroidProfileIsTheOneAppleAccepts() {
143+
assertEquals("<Pixel 7> <Android;14;UQ1A.240205.002> <com.apple.AuthKit/1 "
144+
+ "(com.apple.akd/1.0)>",
145+
Hardware.ANDROID.clientInfo());
146+
assertTrue(Hardware.ANDROID.canSignIn());
147+
assertFalse(Hardware.LEGACY_MAC.canSignIn());
148+
assertFalse(Hardware.IPHONE.canSignIn());
119149
}
120150

121151
/**
@@ -143,20 +173,20 @@ public void everyProfileSuppliesTheSixFieldsFindMyExpects() throws Exception {
143173
}
144174

145175
/**
146-
* A fresh install claims the Mac.
176+
* A fresh install claims the Android phone.
147177
*
148-
* <p>It claimed the iPhone until Apple began answering 401 to {@code get_2fa_methods} for
149-
* clients presenting that profile - provisioning and password auth both succeeded, and the
150-
* very next request did not. The desktop exporter makes the same call against the same
151-
* account and is answered, and this profile is byte-identical to what it provisions with.
178+
* <p>Since 2026-10-12 the Grand Slam handler refuses SRP init for a Mac or iPhone claim
179+
* over the Android-provisioned machine id this app's ADI libraries mint
180+
* ({@code ec=-80045}); the Android claim is answered. See
181+
* {@code AdiDeviceIdentity#generate()} and issue #248.
152182
*
153-
* <p>So this asserts a decision taken from evidence, not a preference. If it ever changes
154-
* back, that has to be because the 2FA question was answered - not because an iPhone icon
155-
* looks better in a device list.
183+
* <p>So this asserts a decision taken from evidence, not a preference. If it ever changes,
184+
* that has to be because the handler's rule changed - re-run the probe first.
156185
*/
157186
@Test
158-
public void afreshIdentityIsTheMacTheExporterAlsoUses() {
159-
assertEquals(Hardware.LEGACY_MAC, AdiDeviceIdentity.generate().hardware());
187+
public void afreshIdentityIsTheAndroidPhoneAppleStillAccepts() {
188+
assertEquals(Hardware.ANDROID, AdiDeviceIdentity.generate().hardware());
189+
assertEquals(Hardware.ANDROID, Hardware.DEFAULT);
160190
}
161191

162192
/**

0 commit comments

Comments
 (0)