From 63f0a8dc64852397c4e4e94cb9947f9642779252 Mon Sep 17 00:00:00 2001 From: "Shane B." Date: Fri, 20 Nov 2026 17:06:21 +0100 Subject: [PATCH 1/2] Spell the legacy Mac's OS as Apple's own akd does, now that Apple refuses macOS Since 2026-11-20 Apple's edge answers every Grand Slam sign-in whose X-MMe-Client-Info says with a 190-byte HTML 503, and lets the identical request saying through. Model, version, build and bundle make no difference; provisioning and the report fetch accept both. The legacy Mac profile, which every install presents, said macOS (#289). - LEGACY_MAC's OS name is now "Mac OS X", so new sign-ins go through on both the local and the remote Anisette transport. - Stored accounts carry their own identity and their password, so FindMy.py would re-authenticate under "macOS" at the next PET renewal and be refused. getAccount respells it on restore; nothing else about the identity moves. - The edge check gains a control for the macOS spelling, so a change to this rule is noticed the way the Xcode one is. Fixes #289 Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 12 ++++ .../anisette/AdiDeviceIdentityTest.java | 5 +- .../anisette/AdiDeviceIdentity.java | 11 +++- app/src/main/python/identity.py | 31 ++++++++++ app/src/main/python/main.py | 2 + app/src/test/python/test_identity.py | 59 ++++++++++++++++++- scripts/check_gsa_edge.py | 21 +++++-- scripts/test/test_check_gsa_edge.py | 33 ++++++++--- 8 files changed, 157 insertions(+), 17 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 16ca0ec1..14740d07 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -618,6 +618,18 @@ curl -so /dev/null -w '%{http_code}\n' -X POST --data-binary t \ app and the exporter send, and opens an issue when one is refused. It would have caught this before the first report. `python scripts/check_gsa_edge.py` asks from your own connection. +**It did, on 2026-11-20 ([#289](https://github.com/parawanderer/OpenTagViewer/issues/289)), and +the rule was a different one.** The edge began refusing any sign-in whose client info spells the OS +``, while the identical request saying `` — what macOS's own `akd` sends — +got through. The legacy Mac profile said `macOS`. Model, version, build and bundle made no +difference; provisioning and the report fetch accept both. Finding it took a dozen requests with +one field changed at a time (the script's `Probe` shape does this), not a day. Two lessons: **any +field in that header can become the one Apple keys on**, so copy Apple's own spelling of each and +not a plausible one; and **a stored session carries its identity and its password**, so it +re-authenticates under the old value on its own. Fixing the profile alone would have left every +existing user to break at their next PET renewal — `identity.respellRefusedOsName` corrects it on +restore. + **So check the neighbours first.** This project shares an authentication path with AltStore, SideStore, Macless Haystack, OpenBubbles and every Anisette server, because they all copied it from the same place. When something that worked yesterday fails for everybody, half an hour diff --git a/app/src/androidTest/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentityTest.java b/app/src/androidTest/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentityTest.java index 95c9d394..14ceccff 100644 --- a/app/src/androidTest/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentityTest.java +++ b/app/src/androidTest/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentityTest.java @@ -45,10 +45,13 @@ public class AdiDeviceIdentityTest { *

Reproduced from the constant this replaced. The whole point of {@code LEGACY_MAC} is * that it did not change, so this string is the specification and the enum is the thing * being checked. + * + *

One deliberate exception: the OS name, {@code macOS} until Apple's edge began refusing + * that spelling at sign-in on 2026-11-20 (#289). It must never go back. */ @Test public void theLegacyMacsClientInfoHasNotMoved() { - assertEquals(" ", Hardware.LEGACY_MAC.clientInfo()); } diff --git a/app/src/main/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentity.java b/app/src/main/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentity.java index 5e668fc8..ce872315 100644 --- a/app/src/main/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentity.java +++ b/app/src/main/java/dev/wander/android/opentagviewer/anisette/AdiDeviceIdentity.java @@ -187,10 +187,19 @@ public enum Hardware { * it has always been wrong, and changing it now would re-identify every existing * install to fix a contradiction Apple has evidently never minded. The new profile does * not have it. + * + *

Except the OS name, which Apple forced. This said {@code macOS} until + * 2026-11-20, when Apple's edge began refusing every Grand Slam sign-in whose client info + * spells it that way - a 190-byte HTML 503, before a credential is looked at (#289). + * {@code Mac OS X} is what macOS's own {@code akd} sends and is let through; model, + * version, build and bundle made no difference either way. Provisioning and the report + * fetch accept both spellings, so nothing else moved. Stored sessions are respelt on + * restore by {@code identity.respellRefusedOsName}, or they would be refused at their + * next re-authentication. */ LEGACY_MAC( "MacBook Pro 13\"", - "MacBookPro13,2", "macOS", "13.1", "22C65", + "MacBookPro13,2", "Mac OS X", "13.1", "22C65", "1404.0.5", "22.3.0", "com.apple.dt.Xcode/3594.4.19") { diff --git a/app/src/main/python/identity.py b/app/src/main/python/identity.py index 5cbeadac..56fa9de0 100644 --- a/app/src/main/python/identity.py +++ b/app/src/main/python/identity.py @@ -263,6 +263,37 @@ def serialOfSession(asyncAccount: Any) -> str: return serial +REFUSED_OS_NAMES = {"macOS": "Mac OS X"} +""" +OS names Apple's edge refuses at sign-in, and the spelling it accepts for each. + +Since 2026-11-20 every Grand Slam sign-in whose client info says `` gets a 190-byte +HTML 503, whatever the model, version or bundle, and the same request saying `` is +let through (#289). Every install on the legacy Mac profile said `macOS`, and a stored session +keeps the identity it was established with - including the password, so FindMy.py +re-authenticates on its own when a PET runs out or a fetch gets a 401. Left alone, every such +session would be refused at that moment and its owner told to sign in again for nothing. +""" + + +def respellRefusedOsName(accountState: dict) -> dict: + """ + Correct a stored account's OS spelling in place, before FindMy.py restores it. + + **An exception to `identityForRestore` keeping everything, and a narrow one.** Model, + version, build, serial and ids stay as they were; only the spelling moves, to the one macOS's + own `akd` uses. Nothing Apple binds a session to is in that string - ADI provisioning and the + report fetch accept either - and the alternative is a session that cannot re-authenticate. + """ + stored = (accountState.get("anisette") or {}).get("identity") + if isinstance(stored, dict) and stored.get("os_name") in REFUSED_OS_NAMES: + before = stored["os_name"] + stored["os_name"] = REFUSED_OS_NAMES[before] + print(f"Stored identity said {before!r}, which Apple now refuses at sign-in; " + f"presenting {stored['os_name']!r} instead (#289)") + return accountState + + def identityForRestore(previous: Any) -> dict: """ The identity a *restored* account should keep: whatever it already had. diff --git a/app/src/main/python/main.py b/app/src/main/python/main.py index 5bab609f..e9889f3e 100644 --- a/app/src/main/python/main.py +++ b/app/src/main/python/main.py @@ -428,6 +428,7 @@ def assertAnisetteIsSupported(serializedAccountData: str) -> str | None: """ try: data = json.loads(serializedAccountData) + app_identity.respellRefusedOsName(data) anisette_type = (data.get("anisette") or {}).get("type") if anisette_type == SUPPORTED_ANISETTE_TYPE: @@ -836,6 +837,7 @@ def getAccount( return None data = json.loads(serializedAccountData) + app_identity.respellRefusedOsName(data) acc = AppleAccount.from_json(data) _preferLocalAnisette(acc, localAnisette) diff --git a/app/src/test/python/test_identity.py b/app/src/test/python/test_identity.py index d2b0d778..a579b239 100644 --- a/app/src/test/python/test_identity.py +++ b/app/src/test/python/test_identity.py @@ -29,7 +29,7 @@ # ones Java actually produces is asserted on device, by IdentityBridgeTest. LEGACY_MAC = { "model": "MacBookPro13,2", - "os_name": "macOS", + "os_name": "Mac OS X", "os_version": "13.1", "os_build": "22C65", "cfnetwork": "1404.0.5", @@ -201,7 +201,7 @@ def test_a_legacy_install_signing_in_again_presents_the_mac_it_provisioned_with( kwargs = identity.identityForNewSession(bridge) assert kwargs["identity"] == DeviceIdentity(**LEGACY_MAC) - assert kwargs["identity"].platform == " " + assert kwargs["identity"].platform == " " def test_the_serial_is_this_installs_even_for_a_legacy_machine_profile(self): """ @@ -565,3 +565,58 @@ def test_a_provider_that_imposed_nothing_writes_nothing(self): assert "serial" not in stored assert "identity" not in stored + + +class TestAStoredMacOsSpellingIsRespelt: + """ + #289: since 2026-11-20 Apple's edge refuses any sign-in whose client info says ``. + + Every legacy-Mac session was stored saying that, with its password, so FindMy.py would + re-authenticate under it the next time a PET ran out - and be refused. The restore is the one + place all of them pass through. + """ + + REFUSED = {**LEGACY_MAC, "os_name": "macOS"} + + def _restored(self, stored_identity): + from findmy.reports.state import LoginState + + imposed = {"identity": DeviceIdentity(**stored_identity)} if stored_identity else {} + account = AppleAccount(RemoteAnisetteProvider( + "https://example.invalid", serial=DRAWN_SERIAL, **imposed, + )) + stored = account.to_json() + stored["login"]["state"] = LoginState.LOGGED_IN.value + + restored = main.getAccount(json.dumps(stored)) + assert restored is not None + return restored._asyncacc._anisette + + def test_a_session_stored_as_macos_comes_back_as_mac_os_x(self): + provider = self._restored(self.REFUSED) + + assert provider.identity == DeviceIdentity(**LEGACY_MAC) + assert provider.identity.platform == " " + + def test_only_the_spelling_moves(self): + """The serial and every other field are what Apple has the session bound to.""" + provider = self._restored(self.REFUSED) + + assert provider.serial == DRAWN_SERIAL + assert {k: v for k, v in provider.identity.to_json().items() if k != "os_name"} == { + k: v for k, v in self.REFUSED.items() if k != "os_name" + } + + def test_other_identities_are_left_exactly_as_stored(self): + assert self._restored(IPHONE).identity == DeviceIdentity(**IPHONE) + assert self._restored(None).identity == CLIENT_IDENTITY + + def test_the_mapping_is_untouched_when_there_is_nothing_to_respell(self): + state = {"anisette": {"type": "aniRemote", "url": "https://example.invalid"}} + + assert identity.respellRefusedOsName(json.loads(json.dumps(state))) == state + + def test_java_no_longer_hands_a_new_session_the_refused_spelling(self): + # The copy at the top of this file is what Java sends; IdentityBridgeTest pins that on + # device. This pins that the copy was moved with it. + assert LEGACY_MAC["os_name"] not in identity.REFUSED_OS_NAMES diff --git a/scripts/check_gsa_edge.py b/scripts/check_gsa_edge.py index e36c386f..8032478f 100755 --- a/scripts/check_gsa_edge.py +++ b/scripts/check_gsa_edge.py @@ -25,9 +25,11 @@ which is all this checks: with a junk body a request that got through is usually a 404 or a 401 rather than a success, and that is fine. -**The Xcode control.** One probe sends the identifier Apple blocked, and is expected to be -refused. It proves the probe can still see the rule. If it starts getting through, Apple has -lifted or reshaped the block; that is reported but is not a failure. +**The controls.** Two probes send what Apple is known to refuse, and are expected to be refused: +the Xcode identifier (September 2026), and the legacy Mac profile with its OS spelt `macOS` +rather than `Mac OS X` (November 2026, #289 - the profile said `macOS` until then, and only the +spelling differs). They prove the probe can still see each rule. If one starts getting through, +Apple has lifted or reshaped that block; that is reported but is not a failure. Exit codes: 0 all as expected, 1 one of this project's identities was refused, 2 Apple could not be reached at all. @@ -180,7 +182,10 @@ def sign_in(client_info: str) -> dict[str, str]: } found: list[Probe] = [] + legacy: Profile | None = None for profile in profiles: + if profile.name == "LEGACY_MAC": + legacy = profile identity = DeviceIdentity.from_json(profile.identity_json()) # type: ignore[arg-type] found.append(Probe( f"sign-in, app {profile.name}", "POST", GSA, @@ -206,6 +211,12 @@ def sign_in(client_info: str) -> dict[str, str]: "sign-in, Xcode control", "POST", GSA, sign_in(CLIENT_IDENTITY.client_info(_XCODE_BUNDLE)), REFUSED, )) + if legacy is not None: + spelt = DeviceIdentity.from_json({**legacy.identity_json(), "os_name": "macOS"}) # type: ignore[arg-type] + found.append(Probe( + "sign-in, macOS spelling control", "POST", GSA, + sign_in(spelt.client_info(_AKD_BUNDLE)), REFUSED, + )) return found @@ -274,8 +285,8 @@ def run(checks: list[Probe], ask: Callable[[Probe], Answer] = fetch, out=sys.std refused.append(probe.name) elif probe.expect == REFUSED and verdict == THROUGH: print( - f"note {probe.name}: Apple no longer refuses the Xcode identifier. The block this " - "check was written for has been lifted or has changed shape. Not a failure.", + f"note {probe.name}: Apple no longer refuses this. The block it was written " + "for has been lifted or has changed shape. Not a failure.", file=out, ) diff --git a/scripts/test/test_check_gsa_edge.py b/scripts/test/test_check_gsa_edge.py index 36278ced..43552dc5 100644 --- a/scripts/test/test_check_gsa_edge.py +++ b/scripts/test/test_check_gsa_edge.py @@ -44,7 +44,7 @@ def test_the_legacy_profile_is_read_despite_its_escaped_quote(): legacy = next(p for p in edge.read_profiles() if p.name == "LEGACY_MAC") assert legacy.model == "MacBookPro13,2" - assert (legacy.os_name, legacy.os_version, legacy.os_build) == ("macOS", "13.1", "22C65") + assert (legacy.os_name, legacy.os_version, legacy.os_build) == ("Mac OS X", "13.1", "22C65") def test_a_constant_the_pattern_cannot_read_fails_loudly(tmp_path): @@ -132,7 +132,7 @@ def test_the_control_getting_through_is_news_not_a_failure(): ]) assert code == 0 - assert "no longer refuses the Xcode identifier" in out + assert "sign-in, Xcode control: Apple no longer refuses this" in out def test_apple_unreachable_is_its_own_exit_code(): @@ -150,22 +150,39 @@ def test_apple_unreachable_is_its_own_exit_code(): def test_the_legacy_profile_signs_in_with_what_the_app_sent(): """ Pinned to the wire, not to this script: the header below is copied from the app's refusal - log on 2026-09-13. If the check ever composes something else, it is probing a request the - app does not make. + log on 2026-09-13, with the OS name respelt `Mac OS X` after Apple began refusing `macOS` + on 2026-11-20 (#289). If the check ever composes something else, it is probing a request + the app does not make. """ pytest.importorskip("findmy") legacy = next(p for p in edge.probes(edge.read_profiles()) if p.name == "sign-in, app LEGACY_MAC") assert legacy.headers["X-MMe-Client-Info"] == ( - " " + " " ) assert legacy.headers["User-Agent"] == "akd/1.0 CFNetwork/978.0.7 Darwin/18.7.0" -def test_only_the_control_names_xcode_on_sign_in(): +def test_only_the_controls_send_what_apple_refuses_on_sign_in(): pytest.importorskip("findmy") sign_ins = [p for p in edge.probes(edge.read_profiles()) if p.name.startswith("sign-in")] for probe in sign_ins: - names_xcode = "com.apple.dt.Xcode" in probe.headers["X-MMe-Client-Info"] - assert names_xcode == (probe.expect == edge.REFUSED), probe.name + client_info = probe.headers["X-MMe-Client-Info"] + refusable = "com.apple.dt.Xcode" in client_info or " Date: Fri, 20 Nov 2026 17:16:04 +0100 Subject: [PATCH 2/2] Respell only on the restore path, not in the provider-type check The earlier commit's edit also landed in assertAnisetteIsSupported, which parses the same JSON into a local that only the type check reads. Harmless, but not where the correction belongs. Co-Authored-By: Claude Opus 5.5 --- app/src/main/python/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/python/main.py b/app/src/main/python/main.py index e9889f3e..ec8bfa7e 100644 --- a/app/src/main/python/main.py +++ b/app/src/main/python/main.py @@ -428,7 +428,6 @@ def assertAnisetteIsSupported(serializedAccountData: str) -> str | None: """ try: data = json.loads(serializedAccountData) - app_identity.respellRefusedOsName(data) anisette_type = (data.get("anisette") or {}).get("type") if anisette_type == SUPPORTED_ANISETTE_TYPE: