Skip to content

Send the anisette server's user agent with GrandSlam requests - fixes HTTP 503 on sign-in with remote anisette - #1851

Open
IgoSzaFIIT wants to merge 1 commit into
altstoreio:classicfrom
IgoSzaFIIT:fix/remote-anisette-user-agent
Open

IgoSzaFIIT wants to merge 1 commit into
altstoreio:classicfrom
IgoSzaFIIT:fix/remote-anisette-user-agent

Conversation

@IgoSzaFIIT

Copy link
Copy Markdown

AltStore never sets ALTAppleAPI.authenticationUserAgent, so since 2.3.1 every GrandSlam request is done with AltSign's fallback User-Agent: akd/1.0 CFNetwork/808.1.4 next to the anisette server's client info. gsa.apple.com refuses about half of those with an HTML 503 page. A sign-in takes three GrandSlam requests (init, complete, apptokens), so most refreshes fail. AltServer already sets the user agent from its anisette server (AnisetteDataManager.swift).

I'm pretty sure this is what people are also describing in #1842.

I started encountering this right after updating my iPhone and iPad to 2.3.1, both on Remote AltServer with a self-hosted anisette v3 server that reports a Mac client info. On 2.3 both refreshed fine. On 2.3.1, one refresh worked after the re-auth and every attempt after that failed with AppleDeveloperError 3000 / HTTP 503.

To narrow it down, I sent GrandSlam init requests with a fake Apple ID from a throwaway anisette machine on the same server, with a fresh OTP each time, and swapped one part of the request at a time between AltSign's 2.3 and 2.3.1 versions. -20970 (wrong account details) means Apple accepted the request, anything else was the 503 page:

Request HTTP 503
2.3 cpd + 2.3 headers 0 / 8
2.3.1 cpd + 2.3 headers 0 / 8
2.3.1 cpd + 2.3.1 headers (UA akd/1.0 CFNetwork/808.1.4) 4 / 8
2.3 cpd + 2.3.1 headers (UA akd/1.0 CFNetwork/808.1.4) 5 / 8
2.3.1 cpd + 2.3.1 headers, UA = the server's user_agent 0 / 8

The other cpd and header changes from rileytestut/AltSign#61 don't matter. The user agent does - with the server's user_agent, the exact 2.3.1 request never got a 503. Sending through Python's urllib or URLSession made no difference.

The fix sets authenticationUserAgent to the user_agent from the server's /v3/client_info response in FetchAnisetteDataOperation, like AltServer does.

Not tested on a device yet, only with the request-level test above. I didn't wanna spam these requests with my real account.

AltStore never set ALTAppleAPI.authenticationUserAgent, so AltSign used its fallback "akd/1.0 CFNetwork/808.1.4"
next to the anisette server's client info, and gsa.apple.com refused about half of those requests with HTTP 503.
AltServer already sets it from its anisette server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant