Strip locale keywords from X-Apple-Locale - fixes 2FA codes never arriving (HTTP 500) - #58
Open
IgoSzaFIIT wants to merge 1 commit into
Open
IgoSzaFIIT wants to merge 1 commit into
IgoSzaFIIT wants to merge 1 commit into
Conversation
IgoSzaFIIT
force-pushed
the
fix/2fa-locale-keywords
branch
from
September 19, 2026 09:31
0a7329f to
af620c9
Compare
…ng sent Apple's 2FA endpoints (gsa.apple.com/auth, /auth/verify/*) answer HTTP 500 with an empty body when X-Apple-Locale carries locale keywords, e.g. "en_US@rg=skzzzz" - what macOS/iOS report when the language's region differs from the device region. Sign-in still succeeds, so the code prompt appears but no code is ever sent. ALTAnisetteData now keeps only language, script and region (initializer and setter), and the sign-in cpd uses anisetteData.locale instead of reading Locale.current directly.
IgoSzaFIIT
force-pushed
the
fix/2fa-locale-keywords
branch
from
September 19, 2026 09:33
af620c9 to
3bb89ae
Compare
This was referenced Sep 19, 2026
|
Thank you for this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apple's 2FA endpoints return HTTP 500 with an empty body whenever
X-Apple-Localecarries a locale keyword, e.g.en_US@rg=skzzzz. That's what macOS and iOS report when the language's region differs from the device region (English with Slovakia as the region, in my case), and AltSign sendsLocale.current.identifieras-is. Sign-in itself still succeeds, so the user gets the code prompt, butGET /auth/verify/trusteddevice(and the SMS variant) fails and no code is ever sent. I'm fairly sure this is what #1804 and #1810 are hitting, and why 1.8.1 only fixed 2FA "for some users".How I narrowed it down: FindMy.py v0.10.2 completes 2FA fine for the same account, from the same Mac, while AltServer 1.8.1 and AltStore 2.3 (remote mode) both get the 500. Before landing on the locale I made AltSign's 2FA request header-identical to SideSign's (App-Info, Accept/Content-Type, serial,
Connection: close, fresh OTP, User-Agents) and it still failed, so I went the other way - started from FindMy.py's working flow and changed one thing per run, each with a fresh, never-trusted anisette machine so Apple always asks for 2FA:GET /authbefore requesting the code (AltSign never calls it)X-Apple-Locale/loc=en_US@rg=skzzzz(AltSign's value on my Mac)X-Apple-I-TimeZone=GMT+2(AltSign's value on my Mac)In run C the 500 already comes from
GET /auth, so it's the 2FA endpoints in general rejecting that locale, while GrandSlam sign-in accepts it.The fix normalizes the locale once in
ALTAnisetteData(initializer and setter) to language, script and region only, and makes the sign-incpduseanisetteData.localeinstead of readingLocale.currentdirectly. That covers the 2FA requests and every developer-services request, for AltServer (both anisette paths) and for AltStore on the device, without touching the call sites.en_US@rg=skzzzzbecomesen_US,de_DE@calendar=japanesebecomesde_DE, and plain identifiers (sk_SK,en_SK,sr-Latn_RS) pass through unchanged. There's a small standalone check for this that compiles against the patchedALTAnisetteData.m(localecheck.m, all cases pass).Verified end to end: I built AltServer from
classic@fafd76eewith AltSignnotarized@468313bplus only this patch (and the Xcode 27 project tweaks needed to compile, nothing behavioral), and signed in with a local anisette machine that had never completed 2FA. Every request came back 200 - the trusted-device code request that returns 500 on stock 1.8.1 went through, the code arrived, and sign-in finished. The iOS side is inferred fromFetchAnisetteDataOperationpassing.currentas well, since I didn't capture the exact locale string my iPhone reports.