Skip to content

Update GrandSlam authentication user agent (notarized line) - #51

Open
Calvin-Zikakis wants to merge 1 commit into
rileytestut:notarizedfrom
Calvin-Zikakis:port/authkit-user-agent-notarized
Open

Update GrandSlam authentication user agent (notarized line)#51
Calvin-Zikakis wants to merge 1 commit into
rileytestut:notarizedfrom
Calvin-Zikakis:port/authkit-user-agent-notarized

Conversation

@Calvin-Zikakis

@Calvin-Zikakis Calvin-Zikakis commented Sep 4, 2026

Copy link
Copy Markdown

Port of #47 by @BreezeDelegate onto notarized. The change is theirs, this just applies it to the other branch, and the commit keeps them as author.

marketplace and notarized have diverged and neither contains the other. #47 targets marketplace, but AltStore's classic and classic_v2.3b1 pin notarized, so AltServer and non EU AltStore builds do not get it. Without this they stay on the 2018 User-Agent.

Why it matters

Apple's GSA edge allows a fixed number of requests per connection before it starts returning 503, and the User-Agent changes that number. Six requests down one reused connection, five trials each, identical every time:

old  akd/1.0 CFNetwork/978.0.7 Darwin/18.7.0        200 200 503 503 503 503
new  AuthKit/1 (Macintosh; OS X 26.5.2) (...26.0)   200 200 200 200 503 503

Two requests on the old string, four on the new one. authenticate() sends three down a single connection, so the third one always fails, which is exactly the reported symptom: init and complete succeed, apptokens returns an HTML 503, and the plist parser reports it as NSCocoaErrorDomain 3840 "Encountered unknown tag html on line 1".

Interleaved over 100 requests each, one at a time on fresh connections:

old  100 requests, 12x 503
new  100 requests,  0x 503

Scope

This is the whole fix for the deterministic part. There is a separate baseline failure of roughly 20 to 25 percent even on a fresh connection's first request, which the User-Agent does not affect (old 15/20, new 16/20). #50 handles that by retrying 5xx on a fresh connection. The two together got a machine that had never completed sign in to 25/25.

Reported in altstoreio/AltStore#1776, #1699, #1747.

The akd/1.0 CFNetwork/978.0.7 Darwin/18.7.0 string dates from macOS 10.14.
Apple's GSA edge now allows only two requests per connection with it, and
sign in sends three, so the third always fails with an HTML 503 that surfaces
as NSCocoaErrorDomain 3840. A current AuthKit string raises that to four.

Port of rileytestut#47 by @BreezeDelegate onto the notarized branch,
which AltStore's classic branches pin.
@Fummy1990

Copy link
Copy Markdown

AltServer HTTP 503 / “Incorrect data format” workaround

Thanks Chatgpt 6 this worked for me !!:

The main file is:

Dependencies/AltSign/AltSign/Sources/ALTAppleAPI+Authentication.swift

The working approach updates the AuthKit User-Agent, uses fresh connections, and retries temporary server errors. Credit: AltSign PR #51 and PR #50.

1. Download the source and dependencies

Requires Xcode and an Apple Silicon Mac.

git clone https://github.com/altstoreio/AltStore.git
cd AltStore
git checkout 5a0f2de77e0723bf782447edbc0ab2bc11688234
git submodule update --init --recursive

2. Apply the proposed authentication patches

set -o pipefail
curl -fsSL https://github.com/rileytestut/AltSign/pull/51.patch \
  | git -C Dependencies/AltSign apply -

curl -fsSL https://github.com/rileytestut/AltSign/pull/50.patch \
  | git -C Dependencies/AltSign apply -

Stop if either command fails. These upstream patches apply to this revision; the successful local test used an adapted retry implementation, not these patches unchanged.

3. Adjust two build settings for current Xcode

In Dependencies/AltSign/Package.swift, replace:

.headerSearchPath("AltSign/**"),

with:

.headerSearchPath("AltSign/include/AltSign"),
.headerSearchPath("AltSign/Apple API"),
.headerSearchPath("AltSign/Model"),
.headerSearchPath("AltSign/Model/Apple API"),
.headerSearchPath("AltSign/Categories"),
.headerSearchPath("AltSign/Signing"),

In AltStore.xcodeproj/project.pbxproj, update the libcorecrypto.tbd file reference to:

path = usr/lib/system/libcorecrypto.tbd;
sourceTree = SDKROOT;

4. Build and sign locally

xcodebuild -workspace AltStore.xcworkspace \
  -scheme AltServer -configuration Release \
  -derivedDataPath build \
  -destination 'platform=macOS,arch=arm64' \
  ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \
  CODE_SIGNING_ALLOWED=NO \
  ENABLE_USER_SCRIPT_SANDBOXING=NO build

Only continue after BUILD SUCCEEDED:

codesign --force --deep --sign - \
  build/Build/Products/Release/AltServer.app

codesign --verify --deep --strict \
  build/Build/Products/Release/AltServer.app

5. Test

Quit the existing AltServer, then launch the new build:

open build/Build/Products/Release/AltServer.app

izaankml added a commit to izaankml/AltSign that referenced this pull request Sep 5, 2026
Since early September 2026 GrandSlam intermittently answers the sign-in
requests with an HTML 503 page instead of a plist, which AltSign fed
straight to PropertyListSerialization and surfaced as the opaque
"Encountered unknown tag html on line 1" (NSCocoaError 3840).

Two changes fix it:

- Send the modern AuthKit User-Agent. Apple now rejects the obsolete
  akd/1.0 CFNetwork/978.0.7 Darwin/18.7.0 string a large fraction of the
  time; the AuthKit string current akd sends is accepted (measured on an
  affected Mac: old string 503'd 12/100, AuthKit 0/100).

- Use a fresh ephemeral URLSession per request and retry. GrandSlam's
  edge assigns a keep-alive connection to one backend node; once that
  node starts failing, every later request on the same connection 503s
  and does not recover. Sign-in sends init, complete and apptokens over
  one shared session, so the third request always failed. A new
  connection per attempt, plus a bounded 5xx retry (up to 5 attempts,
  1/2/4/8s backoff, within the ~30s anisette window), resolves it.

Root cause and approach from altstoreio/AltStore#1776 (Calvin-Zikakis)
and the upstream fixes in rileytestut#47/rileytestut#50/rileytestut#51.
izaankml added a commit to izaankml/AltSign that referenced this pull request Sep 5, 2026
Since early September 2026 GrandSlam intermittently answers the sign-in
requests with an HTML 503 page instead of a plist, which AltSign fed
straight to PropertyListSerialization and surfaced as the opaque
"Encountered unknown tag html on line 1" (NSCocoaError 3840).

Two changes fix it:

- Send the modern AuthKit User-Agent. Apple now rejects the obsolete
  akd/1.0 CFNetwork/978.0.7 Darwin/18.7.0 string a large fraction of the
  time; the AuthKit string current akd sends is accepted (measured on an
  affected Mac: old string 503'd 12/100, AuthKit 0/100).

- Use a fresh ephemeral URLSession per request and retry. GrandSlam's
  edge assigns a keep-alive connection to one backend node; once that
  node starts failing, every later request on the same connection 503s
  and does not recover. Sign-in sends init, complete and apptokens over
  one shared session, so the third request always failed. A new
  connection per attempt, plus a bounded 5xx retry (up to 5 attempts,
  1/2/4/8s backoff, within the ~30s anisette window), resolves it.

Root cause and approach from altstoreio/AltStore#1776 (Calvin-Zikakis)
and the upstream fixes in rileytestut#47/rileytestut#50/rileytestut#51.
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.

3 participants